ZRPL
  • Welcome!
  • Quick Start
  • Reference
    • API Reference
      • Categories List
      • Category Details by ID
      • Create Simple Product
      • Config Product Creation
      • Product List
      • Update Existing Product
      • Product Details by SKU
      • Product Details by ID
      • Products in Category
      • Create Order
      • Order Details
      • Order History
      • Create Customer
      • Customer Token
      • Create Customer Cart
      • Add Item to Cart
      • View Cart
      • Update Cart
      • Delete Cart
      • Country Code
      • Set Shipping and Billing
      • Place Order
      • Customer Details
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Update Cart

This API is offering to Update Cart.

PUT {{Base_url}}/rest/V1/carts/mine/items/97340

This cURL command is used to update the quantity of a specific item (with item_id: 97340) in the customer's shopping cart in a Magento application.

Body

{
    "cartItem": {
        "qty": 5,
        "quote_id": "615984"
    }
}

Attributes Explanation

  1. cartItem:

    • This is the main key that contains the details of the cart item you want to update.

    • It holds the subfields qty and quote_id.

  2. qty:

    • This specifies the new quantity for the item in the cart.

    • Value: 5 (indicates you want 5 units of this product in the cart).

  3. quote_id:

    • This is the unique ID of the cart (also referred to as the "Quote ID").

    • It ensures that the update is applied to the correct cart for the current session or customer.

    • Value: "615984"

curl --location --request PUT '{{Base_url}}/rest/V1/carts/mine/items/97340' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjIxMDAyNywidXR5cGlkIjozLCJpYXQiOjE3Mzc2MTc4MTAsImV4cCI6MTczNzYyMTQxMH0.0ah6EAAskmEp0Q_cg9rKUem_oRr66YLYbtGBQWGsngE' \
--header 'Cookie: PHPSESSID=2639naaq26nbe7st472kk4ms4i' \
--data '{
    "cartItem": {
        "qty": 5,
        "quote_id": "615984"
    }
}

Responses

{
    "item_id": 97340,
    "sku": "IFPZMB-NP0",
    "qty": 5,
    "name": "iFrogz Audio- Ear Pollution Plugz with Mic - Neon Pink",
    "price": 399,
    "product_type": "simple",
    "quote_id": "615984"
}

Explanation

  • item_id:

    • Value: 97340

    • Explanation: The unique identifier for the specific item in the cart. It distinguishes this cart item from others in the same cart.

  • sku:

    • Value: "IFPZMB-NP0"

    • Explanation: The Stock Keeping Unit (SKU) of the product. It is a unique code used to identify the product in the catalog.

  • qty:

    • Value: 5

    • Explanation: The quantity of this product added to the cart. In this case, it indicates 5 units of the product are in the cart.

  • name:

    • Value: "iFrogz Audio- Ear Pollution Plugz with Mic - Neon Pink"

    • Explanation: The name or title of the product as it appears in the catalog.

  • price:

    • Value: 399

    • Explanation: The price of a single unit of the product, expressed in the store’s base currency. This does not include any discounts, taxes, or shipping charges.

  • product_type:

    • Value: "simple"

    • Explanation: The type of product in Magento. Common types include:

      • simple: A standalone product without variations.

      • configurable: A product with multiple variations (e.g., color, size).

  • quote_id:

    • Value: "615984"

    • Explanation: The unique ID of the cart (also known as the quote ID). This links the item to the customer’s active cart and ensures the update is applied to the correct session.

{
    "message": "Current customer does not have an active cart."
}
{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "self"
    }
}
PreviousView CartNextDelete Cart

Last updated 4 months ago