Cart attribute is null in Delivery Customization API

Cart attribute is null in Delivery Customization API

gaal-gergely
Shopify Partner
1 0 0

Hello!

 

I could setup this nodeJS app provided by Shopify:
https://shopify.dev/docs/apps/checkout/delivery-customizations

... using a template in the Sample code section.

 

input.graphql:

query Input {
  cart {
    deliveryGroups {
      deliveryAddress {
        provinceCode
      }
      deliveryOptions {
        handle
        title
      }
    }
    attribute {
      key
      value
    }
  }
}

The attribute is always null.

But in liquid I can see its content printed out successfully in the cart page after sublitting it and return back from the shipping page.

 

<div>
  shippingType<br>
  {{ cart.attributes['shippingType'] }}
</div>

I send this with the form on the cart page:

<input type="hidden" name="attributes[shippingType]" value="mpl_pp">

The order will contain it the note attributes, But the Shopify Function $input part for the delivery customization seems not to be working, as the attribute is always null.

 

Does anyone has the same problem?
Could anyone use the attribute field succesfully in the Delivery Customization API (Shopify Functions)?

 

Cheers

Gergely

Reply 1 (1)

Nick_Wesselman
Shopify Staff
168 42 67

Are you passing the key into the attribute in your input query?

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

 

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