I wanted to point out that I'm not a programmer and it's probably a simple thing but I can't. This function for sending a NEW order WORKS for a zip/zip: {% if shipping_address.zip == '09036' %} SU{{ name }} {% else %} {{ shipping_address.province_code }}{{ name }} {% endif %} But if I want to add many more postcodes, what should I do? I wrote like this but it doesn't work: {% if shipping_address.zip == '09036''09037' %} SU{{ name }} {% else %} {{ shipping_address.province_code }}{{ name }} {% endif %} Thanks a simple answer for solve my problem
Jese Leos
August 19, 2024
Verified user
Go ahead and give this a shot. {% assign zipCodes_list = "09036, 09037" | split: ", " %} {% if zipCodes_list contains shipping_address.zip %} SU{{ name }} {% else %} {{ shipping_address.province_code }}{{ name }} {% endif %} What we're doing is assigning a zipCodes_list variable as a string with your zip codes split by commas since we can't actually instantiate an array natively in liquid. However, by using | split: ", " -- we can turn that string into an array that we can use with the contains check. By checking if the shipping_address.zip is one of the one accepted in the list, we can then determine whether or not we want to show the SU here. Hope this helps!