Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Shopify function - Delivery customization

Shopify function - Delivery customization

Ecommerce5
Shopify Partner
11 0 3

How can I get multiple cart attributes in input.graphql?  the current solution is single attributes; the following is my code, but my requirements are to check various attributes. We are using the delivery customization function.

attribute(key:"attribute name"){
value
}

Replies 3 (3)

SBD_
Shopify Staff
1831 273 421

Hey @Ecommerce5 

 

Try using aliases:

 

something: attribute(key:"something"){
  value
}
another: attribute(key:"another"){
  value
}

Scott | Developer Advocate @ Shopify 

Ecommerce5
Shopify Partner
11 0 3

The solution seems legitimate as I was able to run the type gen command using aliases. But again I am facing an issue with output. 

Ecommerce5_0-1688724611833.png

This is the output I get in my following code. 

query Input {
cart {
orderSat: attribute(key:"Ordered saturday"){
value
}
discountCode: attribute(key:"Discount Code"){
value
}
deliveryGroups {
deliveryAddress {
provinceCode
zip
}
deliveryOptions {
handle
title
cost{
amount
}
}
}
cost {
subtotalAmount {
amount
}
}
}
}

 

could you explain why I am not getting proper results?

attributes under my cart form: 

<input id="hasdiscount" type="hidden" name="attributes[Discount Code]" value="Welcome" >

SBD_
Shopify Staff
1831 273 421

Hey @Ecommerce5

 

You should be able to get discount codes via cart.discountCodes.

Scott | Developer Advocate @ Shopify