Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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!
Solved! Go to the solution
This is an accepted solution.
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.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
This is an accepted solution.
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.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025