Hpw to determine which customer segment a customer belongs to. using storefront API or in liquid.

I’m building an app to display different products for a collection based on the user’s segment. I’m looking for a way to attach a segment identifier as part of the API payload when a request is made from the storefront to my application. This would help me serve products specific to each segment.

I’ve checked the documentation but couldn’t find anything relevant for this use case. Is there a recommended approach to identify user segments and include that information in the payload? Any guidance would be greatly appreciated.

hey @sudarshan follow these steps

Use Customer Tags – Tag users based on their segment and retrieve these tags when making API requests.

Leverage Shopify Customer Segments – If using Shopify Plus, you can use ShopifyQL to filter customers by segments.

Storefront API with Metafields – Attach segment identifiers to customer metafields and fetch them in the storefront API.

Custom Middleware – If needed, use a middleware layer in your app to assign and process segment data dynamically.

if i managed to help you then don’t forget to like and mark it solution

best regard
MUSTUFA