Re: Site Wide Discount for users with certain tags

Solved

Site Wide Discount for users with certain tags

setoseng
Visitor
3 0 2

Hello there,

 

A question for custom storefront using Hydrogen. Is there a way to apply site wide discounts for a signed in user with specific tags? For example, we want to have our "distributor" users with the tag "Pro" to have a 30% discount site wide. I would prefer to not have to use a discount code at check out but rather just have the discount applied once they are logged in. 

Accepted Solution (1)

SBD_
Shopify Staff
1831 273 418

This is an accepted solution.

Hey @setoseng,

 

One approach to solve this would be to combine customer segments and discount codes.

 

First, create a customer segment:

1. Head to Admin > Customers > Segments. Select Create segment.

2. The query would be something like customer_tags CONTAINS 'Pro'  (Apply -> Save Segment)

3. Name the segment something like Distributor.

 

Then, create a discount which can only be used by the above customer segment.

1. Head to Admin > Discounts. Select Create discount > Amount off order

2. Configure the discount code and under 'Customer eligibility' select the new customer segment.


On the Hydrogen side, when a customer logs in, check for a Pro tag and create a session/cookie keeping track of this. Then when they create a cart, conditionally apply the discount code.

 

 

{
  "cartInput": {
    "lines": [ ... ],
    "buyerIdentity": {
      "email": "user@email.com"
    },
    "discountCodes": ["ProDiscount30"]
  }
}

 

 

Let me know if this works out!

Scott | Developer Advocate @ Shopify 

View solution in original post

Replies 2 (2)

SBD_
Shopify Staff
1831 273 418

This is an accepted solution.

Hey @setoseng,

 

One approach to solve this would be to combine customer segments and discount codes.

 

First, create a customer segment:

1. Head to Admin > Customers > Segments. Select Create segment.

2. The query would be something like customer_tags CONTAINS 'Pro'  (Apply -> Save Segment)

3. Name the segment something like Distributor.

 

Then, create a discount which can only be used by the above customer segment.

1. Head to Admin > Discounts. Select Create discount > Amount off order

2. Configure the discount code and under 'Customer eligibility' select the new customer segment.


On the Hydrogen side, when a customer logs in, check for a Pro tag and create a session/cookie keeping track of this. Then when they create a cart, conditionally apply the discount code.

 

 

{
  "cartInput": {
    "lines": [ ... ],
    "buyerIdentity": {
      "email": "user@email.com"
    },
    "discountCodes": ["ProDiscount30"]
  }
}

 

 

Let me know if this works out!

Scott | Developer Advocate @ Shopify 

setoseng
Visitor
3 0 2

This is exactly what I needed. Thank you!