Products
This section details the APIs available for handling products in the Zid Themes Library.
Fetch All Products
Function: fetchAll
Description: Retrieves a list of products based on specified criteria.
Parameters:
catId
: Category ID (passnull
for products from all categories).query
: JSON object with the following properties:page
: Pagination page number.per_page
: Number of items per page.search
: Search term for product name or SKU.on_sale
:0
or1
to filter sale items.sort_by
: Sorting criteria (display_order
,created_at
,popularity_order
,price
).order
: Sort order (asc
,desc
).from_price
: Minimum price filter.to_price
: Maximum price filter.
Usage: zid.store.product.fetchAll(catId, query).then(function (response) { /* Handle response */ });
Fetch Specific Product
Function: fetch
Description: Retrieves details of a specific product or product variant.
Parameters:
id
: Product ID or variant ID.
Usage: zid.store.product.fetch(id).then(function (response) { /* Handle response */ });
Get Product Reviews
Function: getReviews
Description: Fetches reviews for a specified product.
Parameters:
product_id
: The main product ID.page
: Pagination page number.
Usage: zid.store.product.getReviews(product_id, page).then(function (response) { /* Handle response */ });
Add Product Review
Function: addReview
Description: Adds a review to a product.
Parameters:
id
: Main product ID.comment
: Review comment.rating
: Review rating.is_anonymous
: Boolean to indicate if the review is anonymous.
Usage: zid.store.product.addReview(id, comment, rating, is_anonymous).then(function (response) { /* Handle response */ });
Note: The
product_id
can be passed from anonclick
function in your theme's interactive elements.
Get Product Bundle Offer
Function: getProductBundleOffer
Description: Retrieves bundle offers associated with a product.
Parameters:
id
: Main product ID.
Usage: zid.store.product.getProductBundleOffer(id).then(function (response) { /* Handle response */ });