Themes built on the Twig templating engine are now deprecated and require migration to Vitrin to ensure continued support and compatibility with Zid.
This page documents the new Vitrin cart functions and, under each item, shows the old Zid function it replaces.
window.zid.cart.zid.cart.get()zid.store.cart.fetch()zid.cart.addProduct(payload)zid.store.cart.addProduct({ productId, quantity, ... })product_id (required) — Product identifier.quantity (required) — Number of units (> 0).custom_fields (optional) — Array of selected customizations (only send if the product has options like size, color, add-ons, or extra inputs).custom_fields parameter allows you to send product customizations (e.g., size, color, engraving text, file uploads) to the backend. It is an optional array, and each entry represents one selected option or filled input.{
price_settings: string | null; // unique ID linking the choice to backend pricing/variants
group_name: string | null; // label of the group (e.g., "Color", "Add-ons")
group_id: string | null; // unique group identifier
name: string | null; // field/option label or name
value: string | null; // user’s input or selected option
type: 'CHECKBOX' | 'DROPDOWN' | 'TEXT' | 'NUMBER' | 'FILE' | 'IMAGE' | 'TEXTAREA';
}Note: custom_fieldsare optional. Only include them if the product has custom options.
{
"price_settings": "5dd00588-2d18-4613-a991-3e23522b1052",
"group_name": "Extras",
"group_id": "4fba4318-e399-4343-ba5f-e70728b419c5",
"name": "Gift Wrap",
"value": "✔",
"type": "CHECKBOX"
}{
"price_settings": "64c73acb-9d8f-4f1c-afdb-a175bf50ac53",
"group_name": "Color",
"group_id": "bc9b1ba1-3b83-4edd-bb36-1dbf9ca9aaac",
"name": "Red",
"value": "✔",
"type": "DROPDOWN"
}custom_fieldsprice_settings IDs to apply extra charges (e.g., engraving +120 SAR, image upload +150 SAR, color red +234 SAR → total +504 SAR).Key Point: price_settingsis the unique identifier that connects each customization in the cart to backend pricing and inventory logic.
zid.cart.updateProduct({ product_id, quantity })zid.store.cart.updateProduct(cart_product_id, quantity, product_id)id field from cart_response.products[index].id.zid.cart.removeProduct({ product_id })zid.store.cart.removeProduct(cart_product_id, product_id)cart_response.products[index].id).zid.cart.applyCoupon({ coupon_code })zid.store.cart.redeemCoupon(coupon_code)zid.cart.removeCoupons()zid.store.cart.removeCoupon()zid.cart.empty() – remove all items (keep cart session)zid.cart.remove() – delete cart session entirelyzid.store.cart.removeProducts(with_cart_delete)zid.cart.addGiftCard(payload)receiver_name (required) — Name of the gift card recipient.sender_name (required) — Name of the person sending the gift card.media_link (optional) — URL to an image or media associated with the gift card.gift_message (optional) — Personal message to include with the gift card.card_design (optional) — Design template url from the store settings.zid.cart.removeGiftCard()zid.cart.getCalculatedPoints(cartTotal)cartTotal (required) — The cart total amount as a number.zid.cart.getRedemptionMethods(currency)currency (optional) — Currency code (default: 'SAR').zid.cart.getWalletPointsInfo()zid.cart.addRedemptionMethod({ id: 'redemption_method_123' })id (required) — The redemption method identifier.zid.cart.removeRedemptionMethod()zid.cart.getCustomerLoyaltyPoints()id (cart product id) replaces cart_product_id for update/remove operations.redeemCoupon → applyCoupon and removeCoupon → removeCoupons.empty() vs remove() for different clearing behaviors.For product/variant selection rules and complex products, see the Products page.