Hey all,
So we have a bit of code in our checkout “additional scripts” box that essentially looks like this
{% for line in checkout.line_items %}
{% if line.vendor contains ‘xyz’ %}
Shopify.Checkout.OrderStatus.addContentBox(
‘CONTENT BOX CONTENT*’
)
{% endif %}
{% endfor %}
So it checks the vendor of the items in the order and if any of them is ‘xyz’ then it creates the content box. The issue is that if the customer buys more than one product from this vendor then it creates the box multiple times which isn’t ideal. How would I modify this so that it checks that if any of them match this condition, it only posts the box once?
I’m not really great with code but could we use some sort of while loop that gets to i=1 and stops? or maybe declare a variable initially as false and set it to true when it detects the vendor match, then do a separate if statement below that says if variable==true then create content box?
Any ideas would be much appreciated here, thanks!