All guides › Gift wrap option
Shopify gift wrap option without an app: a paid tick box in the cart
Disclosure: I build No-App Sections; this guide was written with AI assistance. The code on this page was written for this guide. It passes Shopify's Theme Check inside Dawn 16.0.0 and automated tests in headless Chrome, run against Dawn's own cart and variant events with mocked store data. It hasn't been run on a live store yet, so try it on a duplicate theme first.
Gift wrap is a small extra that customers expect to see in the cart, as a tick box, not as a product to search for. Shopify has no built-in gift wrap setting, but it doesn't need one: a gift wrap product carries the price, and a tick box on the cart page adds or removes it. Dawn's built-in cart note takes care of the gift message.
How the pieces fit
| Need | Shopify feature used |
|---|---|
| A price for gift wrap, on the order and in reports | A product called "Gift wrap" |
| One tick, one wrap per order | The cart's /cart/update.js endpoint, setting quantity to exactly 1 or 0 |
| A gift message | Dawn's Cart note (Theme settings → Cart) |
| Staff knowing to wrap it | The gift wrap line item on the order |
Step 1: create the gift wrap product
- Products → Add product: title "Gift wrap", your price, and an image of the wrapping if you have one.
- Either untick Track quantity, or keep enough stock. The tick box hides itself if the product is sold out.
- Set it to Active, available on the Online Store channel. The cart can't add a product that isn't on the channel.
- Note its handle, e.g.
gift-wrap. To keep it out of storefront search, add the product metafieldseo.hidden(integer) with value1. Leave it out of your collections.
Step 2: the cart page section
{%- comment -%}
Gift wrap tick box for the cart page ("Custom Liquid" section on the Cart template).
Change 'gift-wrap' to the handle of your gift wrap product.
{%- endcomment -%}
{%- liquid
assign wrap = all_products['gift-wrap']
assign wrap_variant = wrap.selected_or_first_available_variant
assign wrap_qty = 0
for item in cart.items
if item.variant_id == wrap_variant.id
assign wrap_qty = wrap_qty | plus: item.quantity
endif
endfor
assign other_items = cart.item_count | minus: wrap_qty
-%}
{%- if wrap != blank and wrap_variant.available and cart.item_count > 0 -%}
<div class="gift-wrap page-width" id="gift-wrap-{{ section.id }}" data-variant="{{ wrap_variant.id }}">
<label class="gift-wrap__label">
<input
type="checkbox"
class="gift-wrap__box"
{% if wrap_qty > 0 %}
checked
{% endif %}
>
Gift wrap my order (+{{ wrap_variant.price | money }})
</label>
{%- if wrap_qty > 0 and other_items == 0 -%}
<p class="gift-wrap__note">Gift wrap is the only thing in your cart. Untick to remove it.</p>
{%- endif -%}
<p class="gift-wrap__error" role="alert" hidden></p>
</div>
<style>
.gift-wrap { margin-bottom: 2rem; }
.gift-wrap__label { display: inline-flex; align-items: center; gap: 0.8rem; cursor: pointer; }
.gift-wrap__box { width: 1.8rem; height: 1.8rem; }
.gift-wrap__note, .gift-wrap__error { font-size: 1.3rem; margin: 0.6rem 0 0; }
</style>
<script>
(function () {
var root = document.getElementById('gift-wrap-{{ section.id }}');
if (!root) return;
var box = root.querySelector('.gift-wrap__box');
var error = root.querySelector('.gift-wrap__error');
box.addEventListener('change', function () {
box.disabled = true;
error.hidden = true;
var updates = {};
/* Setting the quantity (not adding) means one wrap per order, however often it's ticked. */
updates[root.dataset.variant] = box.checked ? 1 : 0;
fetch(window.routes.cart_update_url + '.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
body: JSON.stringify({ updates: updates })
})
.then(function (r) {
if (!r.ok) throw new Error(r.status);
window.location.reload();
})
.catch(function () {
box.checked = !box.checked;
box.disabled = false;
error.textContent = 'Sorry, gift wrap could not be updated. Please try again.';
error.hidden = false;
});
});
})();
</script>
{%- endif -%}
Why it sets the quantity instead of adding
/cart/add would add another wrap every time someone ticks the box after unticking it, or double-clicks. /cart/update.js with { updates: { variantId: 1 } } sets the quantity, so the result is always one wrap or none. After a successful update, the page reloads so Dawn's cart, subtotal and the tick box all agree. If the request fails, the box flips back to where it was and a message appears.
Step 3: add it to your cart page
- Turn on the cart note. In Customize, open Theme settings → Cart and tick Cart note. Shoppers can write their gift message there.
- Add a Custom Liquid section to the cart. Choose Cart from the page selector, click Add section → Custom Liquid, and drag it below the cart items.
- Paste and set your handle. Paste the code. If your product's handle isn't
gift-wrap, change it on theall_productsline. Click Save. - Test before publishing. Do this on a duplicate theme first and work through the checklist below.
Known limits (and what to do about them)
- Removing the wrap line with the bin icon. Dawn updates the cart items without a reload, but this section isn't part of that update. If a shopper removes the gift wrap line directly, the box stays ticked until the next page load. Nothing is charged wrongly, because the cart is what counts at checkout, but if this bothers you, add a short note such as "Untick to remove gift wrap" next to the box.
- Gift wrap on its own. If the shopper removes everything else, the section says so ("Gift wrap is the only thing in your cart. Untick to remove it.") rather than silently letting them buy just wrapping paper.
- Per item wrapping. This is one wrap per order. For per-item wrapping, set the quantity to the number of items instead. That changes the pricing promise, so make the label clear.
- Cart drawer. This section is for the cart page. With the drawer, shoppers reach it via "View cart". The checkout itself can't be customised this way on non-Plus plans.
Other themes
Nothing here depends on Dawn's JavaScript, so the section works on the cart template of any Online Store 2.0 theme that offers a Custom Liquid section. window.routes.cart_update_url is set by Dawn and many themes based on it. If yours doesn't define it, replace it with '/cart/update', or '{{ routes.cart_update_url }}' inside Liquid. Most themes have a cart note setting too.
Testing checklist
- Tick the box: the page reloads with one "Gift wrap" line and the subtotal goes up.
- Untick: the line is removed.
- Tick, untick, tick quickly: still exactly one wrap.
- Make the wrap product unavailable on the Online Store channel, then tick: the error appears and the box flips back.
- Place a test order with a cart note: the wrap line and the note are both on the order.
Selling other small extras too?
For extras that aren't a yes/no option, such as cards, care kits or samples, the Upsell block shows up to 4 products you pick in the theme editor, with images and add-to-cart buttons. Sold-out products are labelled. £12 one-off, for one store, tested on Dawn and Horizon. Other Online Store 2.0 themes may need small style tweaks.
FAQ
Why a product and not a cart attribute?
An attribute can record "gift wrap: yes", but it can't charge for it. A product puts the price on the order, the receipt and your reports.
Can the gift message be required?
Not with the cart note. It's optional by design. A required field needs checkout changes, which aren't available this way on non-Plus plans.
Does gift wrap affect free shipping thresholds?
Yes, it's a product with a price, so it counts toward the cart subtotal like anything else.
Can I offer free gift wrap?
Set the product price to 0. The label then says "+£0.00", so you may want to edit the wording.
Will it show in Shopify's order printer or packing slips?
Yes, as a normal line item called Gift wrap, which is exactly what tells your team to wrap the parcel.