Ad

Changing A Variable Display From App, From String To Save As An Integer In Liquid

- 1 answer

I'm using an app for my Shopify store called Rewardify. I can't seem to access the variable that saves each individual client's store credit, I just want to change how the credit is displayed.

I've tried using {% capture %} but it just saves the pre-transformed code.

snippet

I expected to get the balance transformed into an integer but instead I just get 0. The class is what transforms the %%BALANCE%% into the credit number into : "$ 100.00 MXN" I just want the number extracted to be modified.

Ad

Answer

Liquid finish it's logic before the DOM is ready. It seems that the code you provided is "transformed" with Javascript, but Javascripts loads after the DOM is ready.

So there is no way to get something with liquid that loads after the DOM.

If you are planing to do something with this value you will need to do this only with Javascript.

Ad
source: stackoverflow.com
Ad