Ad

Shopify - Hidden Properties['...'] In /cart/add Form Are Visible In Shopping Cart

- 1 answer

Inside <form action="/cart/add"> I am using

<input type="hidden" name="properties[myId]" />

to add some technical ID's to the product which I then read using a hook when the product is purchased. It is all working fine except that my hidden inputs are visible in the cart (and it doesn't look very good). Is there a way to add properties which do not appear in the product description in the shopping cart but are still part of the item properties?

Ad

Answer

Placing an underscore at the beginning of the name hides the property: <input type="hidden" name="properties[_myId]" />

https://help.shopify.com/themes/customization/products/get-customization-information-for-products#hide-line-item-properties

Note: while this is true for most themes I have seen some themes where this is not respected... to be used with caution.

Ad
source: stackoverflow.com
Ad