Creating a bundle item from multiple variations of a single item

Using Square’s endpoint API I wrote a script to create a bundle of a small and large coffee that can be sold as a “single line” within an invoice from the Dashboard or the client’s website, neglecting the need for adding both items individually. However, this does not work and I keep getting the following error:

    result = client.catalog.upsert_catalog_object(
    body={
        "idempotency_key": str(idempotency_key),
        "object": {
            "type": "ITEM",
            "id": "#Cocoa_bundle",
            "item_data": {
                "name": "Cocoa Bundle",
                "description": "Hot Chocolate Bundle of Small and Large sizes",
                "abbreviation": "CB",
                "item_variation_ids": ["H6EK5FZ4MMJB56FFASFNYZXC", "NZGVV7TXJHVUMNQAY743FRQX"],
                "track_inventory": False,
            }
        }
    }
)

Response:

  "category": "INVALID_REQUEST_ERROR",
  "code": "BAD_REQUEST",
  "detail": "Item with name Cocoa Bundle and token #Cocoa_bundle must have at least one variation."

However, creating an item with “variations” will ultimately create a new inventory item which is not what want. It needs to be an item linked to the variations: item_variation_ids.

With Square catalog objects creating an bundled item that consists of two existing catalog objects isn’t currently available. You have to create an item with a variation and as you mentioned it will create inventory items.

As a work around you can crate an item with a variation as a bundle and disable inventory tracking. Once this item is sold your application could then adjust the inventory of the actual catalog items with the Inventory API. This will allow you to one item to an order instead of multiple. :slightly_smiling_face:

Thanks Bryan,

Do you have a recommendation or an example on how to do so? How could I have the items point to the catalog items/variations?

The item itself wouldn’t directly point to the catalog item variations within Square. That would be something that your application will have to manage. For example a bundle item will be associated to other catalog object in your application. Once the bundle item is sold your application will need to be notified of the sale and decrement the inventory of the associated items.

Unfortunately, we don’t have an example of this. :slightly_smiling_face: