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
156 39 60

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