Skip to main content
The EcommerceService is used to get all the data related to the eCommerce operations such as get cart details, search products, add products to the wishlist. You can import the EcommerceService from the experro-storefront package.
Here is a list of functions that the EcommerceService provides.
  1. getCart
  2. createCart
  3. updateCustomerId
  4. addToCart
  5. updateCart
  6. deleteItemInCart
  7. search
  8. facetedSearch
  9. getFacetByCategoryName
  10. getProductReviewsByProductId
  11. addProductReview
  12. addCouponCode
  13. removeCouponCodeById
  14. createWishlist
  15. updateWishlist
  16. deleteWishlist
  17. getAllWishlists
  18. getWishlistById
  19. addItemToWishlist
  20. deleteItemFromWishlistById

getCart

The function returns cart details.

createCart

The function is used to create a cart. It accepts an object with customerId and line_items as properties.
If the user is logged in, provide userId as a customerId and line_items is an array of the products object that need to be added in cart.

updateCustomerId

The function updates the customer id for the existing cart. It accepts object with customerId and cartId the properties.
If the user is logged in, provide userId as a customerId.

addToCart

The function adds a product to the cart. It accepts an object with line_items as the property.
The line_items is an array of the product object.

updateCart

The function updates the item in the cart. It accepts an object with itemId and line_item as the properties.
The itemId is the id of the product item or line_item you want to update in the cart.

deleteItemInCart

The function delete the items from the cart. It accepts an object with itemId as the property.

The function provide a ways to search the items or products available for the purchase.It accepts object with searchObj as property.
The searchObj can have the following properties.

facetedSearch

This function returns facets based on search criteria. It accepts an object with searchObj property.

getFacetByCategoryName

The function returns facets based on searched category. It accepts string. The value of the string can either be the name of a category to search or All for a random search.

getProductReviewsByProductId

The function returns reviews for the given product. It accepts an object with productId as the property.

addProductReview

The function add a review for the given product. It accepts an object with productId and body as the properties.
The productId is the provider_id_esi of the particular product. body is an object with following properties.

addCouponCode

This function apply the coupon code for the products in the cart. It accepts an object with body as the property.
body is an object with following property

removeCouponCodeById

The function removes the coupon code. It accepts an object with couponId as property.
The couponId is an id of the particular coupon that should be removed.

createWishlist

This function create a new wishlist. It accepts an object with body property.
body is an object with following property.

updateWishlist

This function update existing wishlist’s items, name, and visibility. It accepts an object with wishlistId and body as the properties.
wishlistId is an id of an existing wishlist. body is an object.

deleteWishlist

This function deletes the wishlist. It accepts an object with wishlistId property.

getAllWishlists

This function returns all the wishlist.

getWishlistById

This function returns wishlist by given id. It accepts an object with wishlistId as property.

addItemToWishlist

This function adds product item into an existing wishlist. The function accepts an object with wishlistId and body as properties.
wishlistId is an id of the existing wishlist in which item needs to be added. The items is an array of the object with product_id and variant_id properties.

deleteItemFromWishlistById

This function deletes a particular item from the wishlist by item id. The function accepts wishlistId and itemId as properties.
The wishlistId is an id of the existing wishlist and itemId is the product item id which is going to be deleted from wishlist.

subscribeToNewsLetter

This method is designed to handle newsletter subscriptions within the context of a BigCommerce store, for now.
This function serves as a valuable tool for incorporating newsletter subscription functionality into a BigCommerce store. You only need to provide an email-id as an input parameter to enable the integration.
Newsletter subscriptions for the BigCommerce store will be processed through this function. If the provided email ID is not already subscribed, the function will execute the subscription. Otherwise, it will return an appropriate error message.