Discussing Shopify Functions development, deployment, and usage in Shopify apps.
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": [ ... ], ... }
Solved! Go to the solution
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
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