Zoey REST API reference ยท Interactive version: apidocs.zoey.com

Cart (Create Order)

Cart (Create Order): Products

Add

POST https://container-url.zoeysite.com/api/rest/checkout2/cart_product

Adding a product to a cart will sometimes require more than just the Product ID. Depending on the specifications of the product you may need to set a specific qty or options, or even super_group or super_attribute, depending on which type of product you are adding.

For more examples of how to add different products, use the example drop-down to change the Example Request.

Query Parameters

key type description
return_data string Optional. What to return instead of true. Supported value: items, which returns the cart item IDs of the added products (see Response). A missing or unsupported value returns true.

return_data must be sent in the query string, e.g. POST /checkout2/cart_product?return_data=items. It is not read from the request body.

Product Data

key type description
product_id string int
sku string The product to add, by SKU.
qty string int
custom_price string float
use_discount flag (1 0)
unique_in_quote flag (1 0)
super_attribute SuperAttributes Used to configure a Configurable product.
super_group SuperGroup Used to configure a Grouped product.
bundle_option BundleOptions Used to configure a Bundle's simple products.
bundle_option_qty BundleOptionQtys Used to configure a Bundle's simple product qty.
comment string Used to set a comment on the item.
options string int

SuperAttributes

key type description
Custom Option Id string int

SuperGroup

key type description
Grouped Product ID string int

BundleOptions

key type description
Bundle Option ID string int

BundleOptionQtys

key type description
Bundle Option ID string int

DateOptionValue

key type description
month string int
day string int
year string int
hour string int
minute string int
day_part string am or pm if your store uses AM/PM. (Required for DateTime / Time)

Response

Without return_data, a successful call returns true.

With ?return_data=items, it returns the cart and one entry per product in the request, in the same order:

{
  "cartId": 123,
  "items": [
    { "item_id": 9001, "product_id": 12, "sku": "A", "qty": 2 },
    { "item_id": 9003, "product_id": 80, "sku": "C-RED-L", "qty": 1, "variation_product_id": 84 },
    { "product_id": 70, "sku": "G", "items": [
      { "item_id": 9010, "product_id": 71, "sku": "G-1", "qty": 2 },
      { "item_id": 9011, "product_id": 72, "sku": "G-2", "qty": 1 }
    ] }
  ]
}

key type description
item_id int null
product_id int The product added. For a configurable product, the configurable (parent) product.
sku string The item's SKU. For a configurable product, the selected variant's SKU.
qty float The cart line's total qty after the add. If the product merged into a line already in the cart, this includes the qty that was already there.
variation_product_id int null
items array Grouped products only: one entry per child product added, with the fields above. A grouped entry has no item_id of its own.

Notes:

Example request body:

{
    "cartId": "51",
    "products": [
        {
            "product_id": "1177",
            "qty": "1",
            "custom_price": 10,
            "use_discount": 1
        },
        {
            "product_id": "1161",
            "qty": "1",
            "custom_price": 10,
            "use_discount": 1,
            "super_attribute": {
                "92": "23"
            }
        },
        {
            "product_id": "1161",
            "qty": "1",
            "custom_price": 80,
            "use_discount": 1,
            "super_attribute": {
                "92": "28"
            }
        }
    ],
    "storeId": null,
    "clearPreviousItems": false
}

Example response (Product Types), HTTP 200:

true

Get

GET https://container-url.zoeysite.com/api/rest/checkout2/cart_product?id=51

Adding a product to a cart will sometimes require more than just the Product ID. Depending on the specifications of the product you may need to set a specific qty or options or even super_group or super_attribute depending on which type of product you are adding.

For more examples of how to add different product, use the example drop down to change the Example Request.

Query parameters:

NameExampleNotes
id51

Update

PUT https://container-url.zoeysite.com/api/rest/checkout2/cart_product

Item identifier is required. You can identify an item by either:

Key Description.
product_id ID of product in the cart.
item_id ID of cart item.
sku SKU of product in cart.
comment Used to set/edit a comment on the item.

Adding a product to a cart will sometimes require more than just the Product ID. Depending on the specifications of the product you may need to set a specific qty or options or even super_group or super_attribute depending on which type of product you are adding.

For more examples of how to add different product, use the example drop down to change the Example Request.

Example request body:

{
    "cartId": "51",
    "products": [
        {
            "item_id": "2355",
            "qty": "2",
            "use_discount": 1
        }
    ]
}

Delete

DELETE https://container-url.zoeysite.com/api/rest/checkout2/cart_product

Item identifier is required. You can identify an item by either:

Key Description.
product_id ID of product in the cart.
item_id ID of cart item.
sku SKU of product in cart.

Example request body:

{
    "cartId": "51",
    "products": [
        {
            "product_id": "1"
        }
    ]
}