Type: Fix / Developer Guide · Stage: Optimize · Topic: Gift wrapping / Line-item properties / Cart
Quick answer
A checkbox labeled “Add gift wrapping (+$5)” does not make Shopify charge $5. If its value is submitted as properties[Gift wrapping], Shopify records a line-item property. That is descriptive data, not a priced product or a discount. To collect a wrapping fee, add a real priced gift-wrap variant (or use a supported add-on app) and keep its quantity and relationship to the purchased item consistent.
Decide first whether wrapping is per item or once per order. That choice determines whether you need a product-level property, an order-level cart attribute, a separate charge, and synchronization when the cart changes.
On this page
Why a checkbox can appear to work while the order is wrong
Shopify’s product form supports line-item properties for things such as engraving text, personalization and gift instructions. They travel with a product variant and can be shown in the cart and order. They do not have their own SKU, inventory, tax treatment or price. A cart note or cart attribute is similarly useful for an order-level instruction, but it is not a charge.
Older gift-wrap tutorials often begin with a cart-page snippet or an order note. That may still work for a free, order-wide message, but it does not solve a modern storefront with a product-page selector, a cart drawer, accelerated checkout buttons, multiple quantities and a fulfillment team that needs to know which item is wrapped. A 2023 cart-page tutorial, for example, assumes the shopper uses the cart page; many stores now have a drawer that needs its own refresh logic.
Pick the right data model
| Requirement | Recommended representation | What to verify |
|---|---|---|
| Free gift message for one product | Line-item property on that product | Message survives cart and order creation |
| Free gift note for the whole order | Cart note or cart attribute | Order-wide instruction appears in admin and fulfillment workflow |
| One paid wrapping fee per order | Separate gift-wrap product variant, plus order-level instruction | Only one charge, even with several products |
| Paid wrapping for selected items | Per-item property plus separately priced add-on line or supported add-on app | Charge and target item remain linked when quantities change |
Capture a free wrapping choice correctly
In a Liquid product section, put the input inside the actual product form, not in a visually nearby accordion outside the form. Shopify documents the properties[Name] input convention:
<label>
<input type="checkbox"
name="properties[Gift wrapping]"
value="Yes">
Add gift wrapping
</label>
<label for="gift-message">Gift message (optional)</label>
<textarea id="gift-message"
name="properties[Gift message]"></textarea>
This captures a choice and message; it does not add a fee. If the store uses a custom JavaScript add-to-cart handler, confirm that handler serializes these inputs. Some custom forms read only the selected variant ID and quantity, silently dropping properties even though the fields are inside the form.
Charge for wrapping with a real variant
Create a gift-wrap product with the intended price, SKU and tax/shipping settings. Make its variant available to the Online Store channel if the Ajax cart is expected to add it. You can keep it out of ordinary merchandising collections without assuming an unpublished product can be purchased.
For a custom theme that owns the add-to-cart request, Shopify’s Ajax API can add multiple variants in one request. This illustrative handler assumes your theme already supplies selectedVariantId, giftWrapVariantId, quantity and wantsGiftWrap:
const items = [{
id: selectedVariantId,
quantity,
properties: wantsGiftWrap ? { "Gift wrapping": "Yes" } : {}
}];
if (wantsGiftWrap) {
items.push({
id: giftWrapVariantId,
quantity: 1,
properties: { "_wrap_for_variant": String(selectedVariantId) }
});
}
const response = await fetch(window.Shopify.routes.root + 'cart/add.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ items })
});
if (!response.ok) throw new Error('Could not add the complete cart selection');
That example charges one fee for this add-to-cart action, not automatically one per order or one per unit. If the policy is per unit, the wrap quantity needs to match the selected item quantity. If the policy is per order, check for an existing wrapping line before adding another. Shopify does not natively enforce a permanent relationship between two ordinary cart lines; your cart drawer, cart page, and downstream fulfillment process must handle the relationship.
A private property beginning with an underscore can carry an internal correlation hint, but it is not a security boundary or a price rule. Shopify says private properties are still available to Liquid and Ajax; the theme must deliberately hide them from customer-facing markup.
Do not forget cart changes and accelerated checkout
The first add-to-cart is the easy part. The real failures happen when a buyer removes the original product but leaves the wrapping fee, increases quantity without updating a per-unit fee, or removes the fee while the product still says “Gift wrapping: Yes.” Decide whether the wrap is optional after addition and how to handle those changes. A dedicated add-on app may be the better decision if it needs robust parent-child behavior across multiple themes or sales channels.
Test accelerated checkout separately. A theme’s {{ form | payment_button }} can create a different purchase path from your custom Ajax click handler. If wrapping is only injected by JavaScript on the ordinary Add to cart button, a buyer may bypass the fee through the accelerated button. Either support both paths correctly or adjust the UI so the wrapping offer is not misleading.
Common misunderstanding
“Line-item properties can add $5 to the product.” They cannot. “Hiding the wrap product from collections makes it unavailable.” Collection visibility and channel availability are different things. “A cart note tells the warehouse which item to wrap.” Not reliably when the cart contains multiple products. The interface can look finished while the charge and fulfillment instructions are disconnected.
How to test this
- Use a test product without wrapping. Add it through the standard button and confirm no wrapping property or fee is present.
- Add the same product with wrapping and a message. Confirm the property is on the intended line and the separate wrap variant is charged exactly once under the chosen fee policy.
- Put two different products in the cart and wrap only one. Confirm the warehouse can tell which item was selected.
- Change quantity, remove the wrapped product, remove the fee and add the product again. Verify that no orphaned fees or stale instructions remain.
- Test the cart drawer, full cart page and any custom mini-cart. Confirm each refreshes after the Ajax request and displays the right total.
- Test the accelerated checkout button and any subscription purchase option. Confirm the fee is not silently bypassed or multiplied.
- Complete a test checkout. Inspect the order’s line items, properties, taxes, packing slip and fulfillment export.
- Repeat in a localized market, checking the Ajax URL, currency and price display.
Sources and further reading
- Shopify developer docs: product forms and line-item properties
- Shopify developer docs: Cart Ajax API and adding multiple variants
- Shopify developer docs: displaying line-item properties
- Shopify developer docs: private properties
- Older external tutorial: cart-page gift wrapping (2023); useful as a historical pattern, not a complete cart-drawer solution
- Shopify Dude: Add to cart redirects instead of opening the drawer
Shopify documentation checked October 27, 2026.

