How can I change a Liquid code operator with JS functions?

yungmuehle
Excursionist
12 2 2

Hey There, 

I've tried to find someting about how to change a Liquid code operator like " {% if product.id == 8841903374659 %} " with a JS script to something like

function changeProductId() { 

var ProductId = 32845384252

/* --> overwriting the current Liquid code or changing the ID */

}

 

Thanks for your help !

 

Replies 3 (3)

PageFly-Oliver
Shopify Partner
878 190 171

Hi @yungmuehle ,

I think you can't change liquid by JS code. because it is 2 different variables

 

Hope my solution works perfectly for you!

Best regards,

Oliver | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

Sweet_Savior_3
Shopify Partner
1201 96 116

hello

 

as i have checked your code.Can you tell me why you want to change the code?

Don't forget to like and accept the solution to help others store owners.
Looking for an expert or Have any queries ? Send query to the Inbox
Coffee Tip ? Pay to shopify.dev.34@gmail.com
From Less To Further !!!
PageFly-Oliver
Shopify Partner
878 190 171

I mean can't set liquid variables by JS

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.