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

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
69 7 12

@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 brands increase D2C sales online.


Problem Solved? ✅ Accept the solution so you can help others.

Confused? Busy? ? Let me solve it for you: rumen@rumendimitrov.com

Buy me a coffee? ☕ paypal.me/braiv

Want to increase revenue? $ Find where you are leaving money on the table with your Shopify store by reading "Your Next Brass Ring"
0 Likes