How to check if a number is divisible by another number in Shopify
Shopify Liquid don’t support a function to check if a number is divisible by another number. But you can combine 2 functions: “modulo” and “if” to do that.
1 2 3 4 5 6 7 8 | {% assign dividend = 7 %} {% assign divisor = 3 %} {% assign remainder = dividend | modulo:divisor %} {% if remainder == 0 %} Divisible {% else %} Not Divisible {% endif %} |