Hi everyone,
For the holiday season we are offering a personalized gift card, but only for select products. We plan to use Shopify’s Order Notes field on the Cart page to enable customers to add their personalized note.
Since this feature is only relevant to some products, Im hoping to display the notes field on cart only if an eligible product is in the cart. Logic in the cart’s liquid like:
IF cart includes item 7625793917133 OR 7625793917156 OR 7625793917236 THEN show {{ Cart Notes }}
If anyone has done this before, or has an idea of the exact code to get this to work it would be helpful. thank u!
What the code would go varies by theme.
For the logic you would want to avoid hardcoding ids and either assign a tag to the product or a specific metafield, have them in a specific collection etc.
So that as you add/remove products you are not automatically making the theme out of date.
Loosely a condition for checking tags would be as follow by adding to the item loop in the relevant cart templates (i.e. {% for item in cart.items %} )
Always backup themes before changing code.
{% if item.product.tags contains "gift note" %}
{% comment %}Add cart note code below {% endcomment %}
{% endif %}
If you need this customization done you can contact me, contact info in signature. Please provide context: post url, store url, theme name, problem description,etc.
Good hunting.
1 Like