New Shopify Certification now available: Liquid Storefronts for Theme Developers

How to create a Customer Segment with an array of Customer ID's?

Solved
Jeff-Blake
Shopify Partner
43 0 9

I'm looking to use the `segmentCreate` mutation to create a segment with an array of specific customer ID's. Looking at the syntax (https://shopify.dev/docs/api/shopifyql/segment-query-language-reference) I don't see that as an option. Is there a solution?

Accepted Solution (1)
Liam
Shopify Staff
Shopify Staff
1898 202 577

This is an accepted solution.

Hi Jeff!

 

To work with segments in Shopify, you can create segments based on conditions using the `segmentCreate` mutation. These conditions can include customer properties, tags, order history, and other criteria. However, the ability to manually add specific customer IDs to a segment is not currently supported - there would need to be a specific property associated with this customer group already.

 

You could look at some alternative approaches such as creating custom customer tags or metafields to group customers and then querying customers based on those tags or metafields. 

 

Hope this helps!

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Reply 1 (1)
Liam
Shopify Staff
Shopify Staff
1898 202 577

This is an accepted solution.

Hi Jeff!

 

To work with segments in Shopify, you can create segments based on conditions using the `segmentCreate` mutation. These conditions can include customer properties, tags, order history, and other criteria. However, the ability to manually add specific customer IDs to a segment is not currently supported - there would need to be a specific property associated with this customer group already.

 

You could look at some alternative approaches such as creating custom customer tags or metafields to group customers and then querying customers based on those tags or metafields. 

 

Hope this helps!

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog