While pretty comfortable with coding, this is in a critical area and I want to get it right.
In snippets/product-price.liquid I want to add the words " per serving" after any item in the collection of “Catering.” In plain language, “if the item is in the collection “Catering,” show the words “per serving” after the price, else just show the price.” I tested just adding " per serving" to any product and that works fine. I just need to add the if-then-else to only do it for Catering products.
This original code is found in snippets/product-price.liquid :
{% if available %}
{% if product.price_varies and template == 'collection' %}
From {{ product.price_min | money }} to {{ product.price_max | money }}
{% else %}
{{ money_price }}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}
{% endif %}
I need help with the section that starts with the if product collection. I’m not sure of the syntax and variables of that statement.
{% if available %}
{% if product.price_varies and template == 'collection' %}
From {{ product.price_min | money }} to {{ product.price_max | money }}
{% else %}
{% if product.collection == "Catering" %}
{{ money_price | append: " per serving" }}
{% else %}
{{ money_price }}
{% endif %}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}
{% endif %}
Thanks in advance.