What's your biggest current challenge? Have your say in Community Polls along the right column.
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.

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

Solved

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

Jeff-Blake
Shopify Partner
45 0 10

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
Community Manager
3108 344 895

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
Community Manager
3108 344 895

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