Zid Docs
Merchant APIApp APIThemes
Merchant APIApp APIThemes
Help Center
Slack
  1. Zid Themes Library: API Integration
  • 🚨 Important Update: Zid Themes
  • Landing Page Development
  • Getting Started with Zid Themes
    • Introduction to Theme Development
    • Manage your Themes
    • Building Themes in Zid
    • Theme File Structure
    • Twig Syntax and Features
    • Zid Theme Packager
  • Templates
    • Layout
    • Home Page
    • Products
    • Cart
    • Store Language and Currency
  • Settings Schema
    • Text
    • Number
    • Text-Area
    • Select
    • Radio Buttons
    • Checkbox
    • Range
    • Color
    • Image
    • Product
    • Category
    • List
    • Fieldset
  • Code Snippets
    • Apple Pay Quick Checkout
    • Custom CSS Injection
    • Displaying the Store's Business Center Logo
    • Customizing Copyright Text
    • Store's Main Navigation Menu
    • Customer Wishlist
    • Products
      • Products Badges
      • Product Ratings
      • Remaining Product Stock
      • Sold Items Count
      • Product Filtration by Attributes
      • Grouped Products
      • Product Questions & Answers
      • Product Restock Notfication
    • SEO
      • Images alt text
      • Themes SEO Marketing Tags
    • Marketing
      • Metafields
      • Gift Feature
      • Loyalty Program
  • Zid Themes Library: API Integration
    • Products
    • Product Categories
    • Cart
    • Blog
    • Customer
    • Store Settings
  • Data Reference
    • Locals
    • Store
    • Cart
    • Product
    • Products List
    • Category
    • Categories List
    • Session
    • FAQs
    • Customer
    • Blogs
    • Page
    • Main Menu
    • Main Navigation Menu
    • Request
    • Orders
    • Addresses
    • Store Payment Methods
    • Store Shipping Methods
    • Store Banks
    • Asset URL
    • Header Meta Tags
    • Loyalty pogram Wallet
  • Themes CLI
    • CLI Authentication
    • Theme Create
    • Theme Package
    • Theme Update
    • Themes List
    • Theme Preview
  1. Zid Themes Library: API Integration

Cart

This section details the functions related to the shopping cart in the Zid Themes Library.
Note: For functions that require a product_id parameter, this parameter can be obtained from user interactions within the theme. An onclick event handler in your theme's interactive elements, such as buttons or images, can capture and pass the product_id to these functions.

Fetch Cart#

Function: fetch
Description: Retrieves the current contents and data of the shopping cart, including products, pricing, applied coupons and offers, and other related attributes.
Usage: 
zid.store.cart.fetch().then(function (response) { /* Handle response */ });

Add Product to Cart#

Function: addProduct
Description: Adds a product to the cart. Useful for simple products, i.e., products with neither variants nor custom input fields. For complex products, refer to the Products Template documentation.
Parameters:
product_id
quantity
options (optional)
custom_fields (optional)
Usage: 
zid.store.cart.addProduct({ productId, quantity }).then(function (response) { /* Handle response */ });

Update Product in Cart#

Function: updateProduct
Description: Updates the quantity of a specific product in the cart.
Parameters:
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.
Usage: 
zid.store.cart.updateProduct(cart_product_id, quantity, product_id).then(function (response) { /* Handle response */ });

Remove Product from Cart#

Function: removeProduct
Description: Removes a specific product from the cart.
Parameters:
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.
Usage: 
zid.store.cart.removeProduct(cart_product_id, product_id).then(function (response) { /* Handle response */ });

Redeem Coupon in Cart#

Function: redeemCoupon
Description: Applies a coupon code to the cart for discounts or offers.
Parameters:
coupon_code
Usage: 
zid.store.cart.redeemCoupon(coupon_code).then(function (response) { /* Handle response */ });

Remove Coupon from Cart#

Function: removeCoupon
Description: Removes any currently applied coupon from the cart.
Usage: 
zid.store.cart.removeCoupon().then(function (response) { /* Handle response */ });
Modified at 2024-11-05 12:43:23
Previous
Product Categories
Next
Blog
Built with