What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Delivery Customization API - Cart attributes

Solved

Delivery Customization API - Cart attributes

sebastiandev
Shopify Partner
72 1 25

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": [
    ...
  ],
  ...
}

 

Accepted Solution (1)

Nick_Wesselman
Shopify Staff
171 43 73

This is an accepted solution.

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

Nick Wesselman | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

View solution in original post

Reply 1 (1)

Nick_Wesselman
Shopify Staff
171 43 73

This is an accepted solution.

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

Nick Wesselman | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog