Delivery Customization API - Cart attributes

Hi,

I would like to condition the display of the shipping method in the cart based on cart attributes. I don’t quite understand how it works and how it can be done.

query Input {
    cart {
        attribute {
            key
            value
        }
        deliveryGroups {
            deliveryAddress {
                provinceCode
            }
            deliveryOptions {
                handle
                code
                cost {
                    amount
                    currencyCode
                }
                title
                description
            }
        }
    }
}

And in delivery input I have null for attributes:

{
  "cart": {
    "attribute": null,
    "deliveryGroups": [
      {
        "deliveryAddress": {
          "provinceCode": null
        },
        "deliveryOptions": [
          ....
        ]
      }
    ]
  }
}

Exists any way to gets cart attributes?

{
  "token": "",
  "note": null,
  "attributes": {
    "test": "yes"
  },
  "items": [
    ...
  ],
  ...
}

Hi @sebastiandev – When querying attribute, you should provide the key argument.

2 Likes