Skip to main content

Build your own gift box section (for developers)

For theme developers: build a custom box UI against Giftcrate's storefront endpoint and cart properties.

Written by Support

Most stores never need this: the Gift box builder block covers it. But a developer can build a fully custom section, or a headless storefront, on the same contract. Validation, discounts, cart merging, multi-address orders and tagging all keep working, because they happen at checkout.

Giftcrate's storefront address is /apps/giftcrate. If you changed it, or another app had it when you installed, yours differs: check Settings → Apps → Giftcrate in Shopify.

1. Read the box settings

Fetch /apps/giftcrate/box/<boxId> on your store's domain (up to 6 IDs, comma-separated, or all). It returns JSON with each box's rules, discount, packaging and allowed products, plus your gift settings. Money is in cents. Responses are cached for 60 seconds.

2. Add the box to the cart

Add every line in one /cart/add.js call. Each line carries:

  • _box_id: a random ID, unique per box added.

  • _box_def: the box's id from the JSON.

  • _box_qty: number of identical boxes as a string ("1", or the recipient count).

Line quantity = per-box quantity × _box_qty.

  • Packaging: add _box_role: "packaging".

  • Gift wrap: add _box_role: "wrap".

  • Message and send date: _gift_message and _send_date (YYYY-MM-DD) on the first item.

  • Gift receipt: cart attribute Gift receipt = Yes.

Checkout only merges and discounts boxes that match their rules, so your UI checks are for shopper experience, not security.

3. Multiple recipients (optional)

POST recipients to /apps/giftcrate/recipients (JSON or CSV text). Put the returned id in the _recipient_list cart attribute, and add the "Extra recipient shipping" variant with quantity = recipients − 1, without _box_* properties.

Stability

These endpoints and properties are a public contract. Fields may be added, but existing ones won't be renamed or removed.

Full reference

Contact us for every field, error code and a starter Liquid section.

Did this answer your question?