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.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Retrieving additional information from customer/company in a Shopify function

Retrieving additional information from customer/company in a Shopify function

petertoye
Shopify Partner
1 0 0

Hi,

 

We would like to create a custom function that during checkout validates whether the customer has overdue payments. In the Input GraphQL object this information is not available (both the customer and company objects are but there is limited info that you can request for these, you can for example request the number of orders but not the number of overdue payments).

 

Is there any way to retrieve this information from within the function itself? As we understand it the only information you can get use in the function is whatever can be specified in the Input GraphQL, or is it possible to retrieve additional information?

Reply 1 (1)

Nick_Wesselman
Shopify Staff
171 43 73

The input query is indeed the only mechanism for feeding data into a Function. If the schema is missing information you need for your use case, you might submit a feature request here:

https://github.com/Shopify/function-examples/discussions

 

As a workaround, you could use a job to populate a metafield or tag on the customer, and read that from the Function.

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