How i write the i%2==0 is shopify?

Highlighted
New Member
1 0 0

 I have write this on shopify like this {% assign i = i | plus: 1 %} {% if i%2 == 0 %} but doesn't work

0 Likes
Highlighted

follow this link for more information : https://help.shopify.com/en/themes/liquid/filters/math-filters#modulo

 

for i%2==0 use like this:

{{ 12 | modulo:5 }}

Shopify theme developer and customization

I Would like to add new functionality or customize an existing one, please hire me.
If helpful then please Like and Accept Solution .
Email: ashiquehussaincodediary@gmail.com

0 Likes
Highlighted
Shopify Partner
76 8 19

@Guleria911 

Here is your code, rewritten

{% assign i = i | plus: 1 %} 
{% assign m =  i | modulo: 2 %} 
{% if m == 0 %} 
do something here
{% endif %}

 

And yes, follow @ashiqueh4 's link to the documentation of math filters, if you want to know more :) 

I help family-run Shopify stores increase sales from existing traffic Learn More
Problem Solved? ✅ Accept the solution so you can help others.
Confused? Busy? Let me solve it for you: rumen@rumendimitrov.com
Did my answer save you time? Buy me a coffee, please ☕ :) paypal.me/braiv
0 Likes