Discussing Shopify Functions development, deployment, and usage in Shopify apps.
We are writing a Delivery Customization function for our B2B Shopify Plus store.
We have enabled the "Allow customers to ship to any address" checkout setting for our B2B companies.
We need to determine if the user entered in a new address at checkout, or if they chose the location's default shipping address so that we can enable/disable 'Drop Ship' fees.
However, the data that is passed into the Delivery Customization has only the 'deliveryAddress'. I've found no way to determine if that is entered during checkout or taken from the company location, or to compare it to data that exists on the B2B company.
The company location object (https://shopify.dev/docs/api/functions/reference/delivery-customization/graphql/common-objects/compa... ) doesn't actually have address data to compare to, and I don't see any indicator in the function input that could be used to determine a manually entered address.
I also couldn't find a way to 'fetch()' additional location data from Shopify from within the Delivery Customization function.
Is there a way around this?
I would greatly appreciate any suggestions.
Hi @emalueg --
The only option for getting custom data into a function would be metafields or cart attributes. I'm assuming that this isn't a practical workaround. You might post a feature request here:
https://github.com/Shopify/function-examples/discussions/categories/feedback-delivery-customization-...
-Nick
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
Thanks for the reply.
I don't think address information should be custom data for a location, so I'll put in a feature request.
We love extensibility but its just not quite fleshed out enough for some of the B2B scenarios we have.
I actually ended up putting the address data in metafields on each location during our feed from the CRM, so I'm able to get the data I need for now.