Most themes automatically don't display line item properties which begin with an underscore (_). This is because these properties are not displayed in checkout, and it's widely accepted that these properties should be hidden.
If your theme does not hide these, you'll want to update your cart's code to not show these.
Find Your Cart File
In your theme's code editor, you'll want to find the file that is rendering the cart. Start by opening something named one of these:
Templates / cart.liquid
Templates / cart.json
If your theme has the cart.json
style, then you'll need to track down the section that's being loaded. Find the section which sounds like it's loading the items in the cart. In this case, it's called main-cart-items
Open the Sections folder, and open the Liquid file that matches the name above. In this case, Sections/main-cart-items.liquid
Find the Properties Loop
Every theme will have a for
loop that loads all of the properties for a line item. You can search your theme for .properties
to look for this loop.
Next, we'll create a new variable which tracks the first character of the property. Be sure to replace the word property with whatever your theme uses in its for loop.
{%- assign property_first_char = property.first | slice: 0 -%}
Finally, we'll update the if
statement so that the property is only displayed if the first character is not an _. This will depend on your theme, but an example is provided below.
Save this file, and load up a cart with a gifted item to see if that worked. You should also test to ensure that other properties do appear correctly.
If you need a hand with this please reach out to us via chat.