Themes built on the Twig templating engine are now deprecated and require migration to Vitrin to ensure continued support and compatibility with Zid.
Note: For functions that require a product_id
parameter, this parameter can be obtained from user interactions within the theme. Anonclick
event handler in your theme's interactive elements, such as buttons or images, can capture and pass theproduct_id
to these functions.
fetch
zid.store.cart.fetch().then(function (response) { /* Handle response */ });
addProduct
product_id
quantity
options
(optional)custom_fields
(optional)zid.store.cart.addProduct({ productId, quantity }).then(function (response) { /* Handle response */ });
updateProduct
cart_product_id
- The identifier for the product entry within the cart (cart.products[].id
in the Cart payload.quantity
- The new quantity of the product.product_id
- The original product identifier (cart.products[].product_id
in the Cart payload.zid.store.cart.updateProduct(cart_product_id, quantity, product_id).then(function (response) { /* Handle response */ });
removeProduct
cart_product_id
- The identifier for the product entry within the cart (cart.products[].id
in the Cart payload.product_id
- The original product identifier (cart.products[].product_id
in the Cart payload.zid.store.cart.removeProduct(cart_product_id, product_id).then(function (response) { /* Handle response */ });
redeemCoupon
coupon_code
zid.store.cart.redeemCoupon(coupon_code).then(function (response) { /* Handle response */ });
removeCoupon
zid.store.cart.removeCoupon().then(function (response) { /* Handle response */ });