Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
I am working on an app. I want customer to input zip code in cart which is already done by add it to cart attributes.
When customer click on checkout button. On page checkout I want the shipping address to come from the cart attributes. How can I do that?
Hey @Uysim ,
Use the Storefront API to create the customer first and set-up their address to have the Zip Code plus all of the additional information. (https://shopify.dev/docs/storefront-api/reference/mutation/customercreate?api[version]=2020-04)
Then use the Storefront API to create the checkout/cart (https://shopify.dev/docs/storefront-api/reference/mutation/checkoutcreate?api[version]=2020-04), and the following mutation to associate the customer with that checkout/cart: https://shopify.dev/docs/storefront-api/reference/mutation/checkoutcustomerassociatev2?api[version]=...
Now once the user is taken to the 'webUrl' of the checkout object (e.g. the Shopify checkout page), they will already have their email address and Zip code filled in.
Hassain | Developer Support Specialist @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
Alternatively, you could more simply just use the Storefront API to create the checkout (https://shopify.dev/docs/storefront-api/reference/mutation/checkoutcreate?api[version]=2020-04) and then use this mutation to update the Shipping Address of that checkout with the correct Zip code: https://shopify.dev/docs/storefront-api/reference/mutation/checkoutshippingaddressupdatev2?api[versi...
This way you can skip all the steps and processes for customer creation
Hassain | Developer Support Specialist @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
User | RANK |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |