Cart
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 Cart
fetch
zid.store.cart.fetch().then(function (response) { /* Handle response */ });
Add Product to Cart
addProduct
product_id
quantity
options
(optional)custom_fields
(optional)zid.store.cart.addProduct({ productId, quantity }).then(function (response) { /* Handle response */ });
Update Product in Cart
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 */ });
Remove Product from Cart
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 */ });
Redeem Coupon in Cart
redeemCoupon
coupon_code
zid.store.cart.redeemCoupon(coupon_code).then(function (response) { /* Handle response */ });
Remove Coupon from Cart
removeCoupon
zid.store.cart.removeCoupon().then(function (response) { /* Handle response */ });
Modified at 2024-11-05 12:43:23