Add to Cart

Adding a product to cart this API is used. For non variants products don't have variation id.

Add to Cart API

The Add to Cart API enables users to add products to their shoppiing cart on the e-commerce platform. This API allows customers to select specific product variations and set the desired quantity for each item, effectively building their shopping cart for a seamless checkout process.

Add to cart prompt

Endpoint

  • {{baseurl}}/api/v1/customer/add-to-cart

Method

  • POST

Authorization

The API requires a valid bearer token in the request header for authentication and user authorization. Users must provide a token to access their personalized shopping cart.

Request Body

The API expects a JSON object containing the following parameters:

  • product_id: The unique identifier of the product to be added to the cart.

  • product_variation_id: The specific variation of the product selected (if applicable).

  • quantity: The quantity of the product to be added to the cart.

Response Format: The API responds with a JSON object indicating the status of the cart addition request. It provides information about the updated cart, including the product details, variation details (if applicable), and the new total quantity of items in the cart.

Features:

  • The Add to Cart API allows users to easily add products to their shopping cart on the platform.

  • Users can select specific variations of a product, such as size and color, based on available options.

  • The API ensures that the product quantity added to the cart does not exceed the available stock.

Usage:

The Add to Cart API is utilized when users browse the product catalog and decide to purchase items. When a customer finds a product they wish to buy, they can use this API to add it to their shopping cart, making it easier to manage and review items before proceeding to the checkout.

Last updated