Modify items in a Cart
Items in a cart can be modified in two ways:
- Update SKU Quantity
- Delete SKU from Cart
When adding SKUs to a cart, we actually create optimized models called OrderSKU
s. When making modifications to an item in a cart, you are actually interacting with the OrderSKU
, which has a different Id
to the original SKU
; you can find the original Id
listed as sku_id
.
Update SKU Quantity
Once an item is added to a cart, you may want to let the shopper increase or decrease the quantity of the SKU in the cart.
If you update the quantity of the cart, you will want to make sure to get the most recent price for the cart with the new quantity. If doing this after shipping methods have been selected, you may want to return to this step.
Let’s start with a Cart shown below:
You can update the quantity of a SKU in the cart using the Update SKU in Cart endpoint.
The response will be a standard Cart
response with the updated SKU values reflected in their respective Bags
.
Delete SKU from Cart
After deleting a sku from the cart you will need to re-price the cart. If you had previously selected a shipping method, that shipping method will be removed and you will need get new ones.
If you want to delete the SKU from the Cart altogether, you can use the Delete SKU from Cart API. This will delete the item in the cart that matches the order_sku_id
that you pass in.
The response will be a standard Cart
response with the updated SKU values reflected in their respective Bags
.
Was this page helpful?