Gift wrapping
A tick box in the cart adds gift wrapping. In the cart drawer it leads the extras, above Add a note and Add a discount. It appears in both the cart drawer and the cart page, and the two stay in step with each other.
The wrap is a real product
Section titled “The wrap is a real product”This is the design decision that matters. Wrapping is a product you create in admin and select in theme settings — not a free cart attribute.
Which means it is priced, taxed, counted in inventory and fulfilled like anything else you sell. A wrap expressed as an attribute is a note that never reaches the packing bench, isn’t charged for, and doesn’t stop you promising wrapping after you’ve run out of boxes.
How it shows in the cart
Section titled “How it shows in the cart”Wrapping is an add-on, not something the shopper picked off a shelf, so the cart doesn’t treat it like a product:
- It isn’t listed among the items in the cart drawer or on the cart page, and it isn’t counted in the bag number in the header or the drawer.
- Its price shows as its own line in the totals, above the subtotal:
| Line | Example |
|---|---|
| Items | $3,000.00 |
| Gift wrapping | $10.00 |
| Subtotal | $3,010.00 |
- The tick box is the only control for it. Untick it to take the wrapping off.
- If the shopper removes their last product, the wrapping is removed too, so a bag can never hold only wrapping.
-
Create the product. In admin, add a product called Gift wrapping at whatever you charge. Give it a weight if you ship by weight.
-
Keep it out of the catalogue. Don’t add it to any collection you merchandise, and consider leaving it off the “All products” navigation. It should be reachable by the theme, not browsable.
-
Decide on inventory. Track it if boxes are finite and you’d rather sell out than over-promise. Leave tracking off if you’ll never run out.
-
Select it in the theme. Theme settings → Cart → Gift wrap product.
Settings
Section titled “Settings”Theme settings → Cart
| Setting | Type | Default | What it does |
|---|---|---|---|
| Gift wrap product | Product | (empty) | The wrap product. Leave empty to hide the option entirely |
| Gift wrap label | Text | Add gift wrapping | The tick box label |
The control only renders when a product is selected and that product is available. An out-of-stock or unpublished wrap product hides the option rather than offering something that will fail at add.
How it behaves
Section titled “How it behaves”- Ticking the box adds one of the wrap product to the cart.
- Unticking it finds that line by variant id and sets its quantity to zero.
- The state is read from the cart itself, not from a cookie — the theme checks whether the wrap is already in the bag, so the box is correctly ticked when a shopper returns to a cart that already has wrapping in it.
- Checking by variant means that if you swap the wrap product later, an old wrap line doesn’t leave the new box falsely ticked.
- Both copies stay in sync. The cart drawer and the cart page can both be on the page at once, and both controls are updated together. A failed request puts the control back where the cart actually is rather than leaving a tick that didn’t happen.
Accessibility
Section titled “Accessibility”- A real
<input type="checkbox">with a<label>, not a styled div — so it toggles with Space and is announced as a checkbox. - The custom box styling keeps a visible
:focus-visibleoutline.
Locale keys
Section titled “Locale keys”cart.gift_wrap_line — the Gift wrapping line in the totals.