Adding an item to a Cart is the first step of the Checkout process. You can do this either during Cart creation or through a dedicated API during the checkout process.

Violet recommends adding SKUs during cart creation. This is because any call that changes a cart also makes an underlying call to relevant merchant stores and impacts your rate limits.

Create Cart + Add Item to Cart

In addition to other inputs, the Create Cart endpoint also takes in a list of SKUs along with their quantity as seen below:

"skus": [
      {
	      "sku_id": 10000,
	      "quantity": 1
		  }
  ]

If provided, the Cart created will include these these items. In the example response below, an item was added from The Violet Garden, one of the stores we have available in sandbox to place orders against.

{
    "id": 74909,
    "token": "f43a41f11ea34a06a1c247934f038d0f",
    "user_id": 10397,
    "app_id": 10382,
    "developer_id": 10292,
    "bags": [
        {
            "id": 60593,
            "order_id": 74909,
            "merchant_id": 10189,
            "app_id": 10382,
            "status": "IN_PROGRESS",
            "fulfillment_status": "PROCESSING",
            "financial_status": "UNPAID",
            "skus": [
                {
                    "id": 79315,
                    "merchant_id": 10189,
                    "app_id": 10382,
                    "product_id": "87f88388d8a44de6b7ea74d1b822926f",
                    "sku_id": 196585,
                    "external_id": "45101059440941",
                    "name": "Pastel Flower Land - Extra-Large / Design Three / Blue",
                    "brand": "The Violet Garden",
                    "thumbnail": "https://cdn.shopify.com/s/files/1/0758/9363/7421/files/wealthy_floral_design_tshirt_with_a_blue_pastel_colour_backgrou_caefa8e2-b19a-4eb7-84a1-1855591d017b.png",
                    "quantity": 1,
                    "price": 3500,
                    "weight": 3.0,
                    "available": true,
                    "status": "IN_PROGRESS",
                    "product_type": "PHYSICAL",
                    "line_price": 3500
                }
            ],
            "taxes": [],
            "sub_total": 3500,
            "taxes_included": false,
            "transactions": [],
            "external_checkout": true,
            "commission_rate": 25.0,
            "date_created": "2023-09-14T19:49:51+0000",
            "remorse_period_ends": "2023-10-14T19:49:51+0000",
            "currency": "USD",
            "external_currency": "USD",
            "channel": "APP",
            "platform": "SHOPIFY",
            "fulfillments": [],
            "discounts": [],
            "wallet_based_checkout": false,
            "bag_id": 60593,
            "bag_status": "IN_PROGRESS",
            "merchant_name": "the violet garden"
        }
    ],
    "sub_total": 3500,
    "status": "IN_PROGRESS",
    "is_guest": true,
    "date_created": "2023-09-14T19:49:51+0000",
    "date_last_modified": "2023-09-14T19:49:51+0000",
    "priced": false,
    "wallet_based_checkout": false,
    "currency": "USD",
    "errors": [],
    "channel": "APP",
    "currency_symbol": "$",
    "stripe_key": "pk_test_UHg8oLvg4rrDCbvtqfwTE8qd",
    "order_id": 74909,
    "intent_based_checkout": false,
    "guest": true,
    "order_status": "IN_PROGRESS"
}

Add Item to Cart

The Add SKU to Cart API lets you add items to a cart at any point up until a Cart has been submitted.

In this scenario, only one SKU can be added at a time. A sample body can be seen below:

{
      "sku_id": 10000,
      "quantity": 1
}

The response for this call will be similar to the one above.

When adding SKUs to a cart, we actually create optimized models called OrderSKUs, . 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.