Sync cart item catalog

PUT {{baseUrl}}/v1/catalogs/:catalogId/sync

Perform one or more of the following sync actions on this cart item catalog, up to 1000 actions:

  • Add an item to the catalog.

  • Edit the attributes of an item in the catalog.

  • Edit the attributes of more than one item in the catalog.

  • Remove an item from the catalog.

  • Remove more than one item from the catalog.

Note: For more information, see our documentation on managing cart item catalogs.

Filtering cart items

Use cart item attributes
to filter items and select the ones you want to edit or delete when editing or deleting more than one item
at a time.

The filters array contains an object with the following properties:

  • attr: A cart item attribute
    connected to the catalog. It is applied to all items in the catalog.

  • op: The filtering operator indicating the relationship between the value of each
    cart item in the catalog and the value of the value property for the attribute selected
    in attr.

    The value of op can be one of the following:

    • EQ: Equal to value
    • LT: Less than value
    • LE: Less than or equal to value
    • GT: Greater than value
    • GE: Greater than or equal to value
    • IN: One of the comma-separated values that value is set to.
**Note:** `GE`, `LE`, `GT`, `LT` are for numeric values only.

  • value: The value of the attribute selected in attr.

Payload examples

Synchronization actions are sent as PUT requests. See the structure for each action:

Adding an item to the catalog

{
  "actions": [
    {
      "payload": {
        "attributes": {
          "color": "Navy blue",
          "type": "shoes"
        },
        "replaceIfExists": true,
        "sku": "SKU1241028",
        "price": 100,
        "product": {
          "name": "sneakers"
        }
      },
      "type": "ADD"
    }
  ]
}

Adding multiple items to the catalog

{
  "actions": [
    {
      "payload": {
        "attributes": {
          "color": "Navy blue",
          "type": "shoes"
        },
        "replaceIfExists": true,
        "sku": "SKU1241027",
        "price": 100,
        "product": {
          "name": "sneakers"
        }
      },
      "type": "ADD"
    },
    {
      "payload": {
        "attributes": {
          "color": "Navy blue",
          "type": "shoes"
        },
        "replaceIfExists": true,
        "sku": "SKU1241028",
        "price": 100,
        "product": {
          "name": "sneakers"
        }
      },
      "type": "ADD"
    }
  ]
}

Updating the attributes of an item in the catalog

{
  "actions": [
    {
      "payload": {
        "attributes": {
          "age": 11,
          "origin": "germany"
        },
        "createIfNotExists": false,
        "sku": "SKU1241028",
        "product": {
          "name": "sneakers"
        }
      },
      "type": "PATCH"
    }
  ]
}

Updating the attributes of multiple items in the catalog

{
  "actions": [
    {
      "payload": {
        "attributes": {
          "color": "red"
        },
        "filters": [
          {
            "attr": "color",
            "op": "EQ",
            "value": "blue"
          }
        ]
      },
      "type": "PATCH_MANY"
    }
  ]
}

Removing an item from the catalog

{
  "actions": [
    {
      "payload": {
        "sku": "SKU1241028"
      },
      "type": "REMOVE"
    }
  ]
}

Removing multiple items from the catalog

{
  "actions": [
    {
      "payload": {
        "filters": [
          {
            "attr": "color",
            "op": "EQ",
            "value": "blue"
          }
        ]
      },
      "type": "REMOVE_MANY"
    }
  ]
}

Removing shoes of sizes above 45 from the catalog

Let's imagine that we have a shoe store and we have decided to stop selling shoes larger than size 45. We can remove from the catalog all the shoes of sizes above 45 with a single action:

{
  "actions": [
    {
      "payload": {
        "filters": [
          {
            "attr": "size",
            "op": "GT",
            "value": "45"
          }
        ]
      },
      "type": "REMOVE_MANY"
    }
  ]
}

Request Body

{"actions"=>[{"type"=>"ADD"}], "version"=>244}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Acceptstring