Required Shopify Configuration
To run the B2B auto-discount system, configure these four elements in Shopify admin:
- Customer Tags - Identifiers for B2B customers
- Customer Segments - Group customers by tags
- Collections - Organize B2B-eligible products
- Coupons (Discount Codes) - Handle actual discounting
Let's look at each in detail.
Step 1: Tag Customers
Assign tags to B2B accounts following specific rules.
Tag Naming Convention
category-code-discount-rate
Examples:
| Tag Name | Category | Discount |
|---|---|---|
| standard-35 | Standard category | 35% OFF |
| premium-25 | Premium category | 25% OFF |
| elite-20 | Elite category | 20% OFF |
| special-40 | Special category | 40% OFF |
Why This Naming Convention?
Embedding the discount rate in the tag name lets the frontend extract the rate just by reading the tag.
Get tag "standard-35"
↓
Extract "35" as number
↓
Calculate as 35% OFF
As we'll see later, this tag name also becomes the coupon name.
Multiple Tags
You can assign multiple tags to one customer.
Example: A dealer handling multiple categories
standard-35(Standard 35% OFF)premium-25(Premium 25% OFF)
When this customer adds products from both categories to cart, each gets the appropriate discount.
How to Tag in Shopify
- Admin → Customers → Select target customer
- Enter tag following the above rules in Tags field
- Save
For bulk tagging, use CSV import or Admin API automation.
Step 2: Create Customer Segments
Customer segments group customers meeting specific conditions. This enables coupons that apply "only to people with this tag."
Creating Segments
- Admin → Customers → Segments
- Click "Create segment"
- Set conditions
Condition Example
Customer tags contains standard-35
Saving with this condition creates a segment containing only customers with the standard-35 tag.
Create Segments for Each Tag
Create a segment for each tag.
| Segment Name | Condition |
|---|---|
| B2B Standard 35 | Tag contains standard-35 |
| B2B Premium 25 | Tag contains premium-25 |
| B2B Elite 20 | Tag contains elite-20 |
| B2B Special 40 | Tag contains special-40 |
Step 3: Create Product Collections
Organize products eligible for B2B discounts into collections.
Creating Collections
- Admin → Products → Collections
- Click "Create collection"
- Enter collection name (e.g.,
B2B Standard Products) - Add products manually or automatically
Using Automated Collections
You can set conditions to automatically add products.
Examples:
- Auto-add products with type "Standard"
- Auto-add products from specific vendors (brands)
Collection Design Example
| Collection Name | Contents |
|---|---|
| B2B Standard Products | Standard category B2B products |
| B2B Premium Products | Premium category B2B products |
| B2B Elite Products | Elite category B2B products |
Step 4: Create Coupons (Discount Codes)
Now for the core part. Create coupons with names exactly matching the tags.
Coupon Creation Steps
- Admin → Discounts → "Create discount"
- Select Discount code
- Configure the following settings
Key Settings
Code Name:
standard-35
(Must exactly match the tag name)
Discount Type:
- Percentage
Discount Value:
35%
(Must match the number in the tag name)
Applies To:
- Specific collections → Select
B2B Standard Products
Customer Eligibility:
- Specific customer segments → Select
B2B Standard 35
Usage Limits:
- Number of uses per customer: Unlimited (or as desired)
Settings Summary Table
| Item | Value |
|---|---|
| Code name | standard-35 |
| Type | Percentage discount |
| Rate | 35% |
| Applies to | B2B Standard Products collection |
| Eligible customers | B2B Standard 35 segment |
Create Coupons for Other Tags Similarly
| Coupon Name | Discount | Target Collection | Target Segment |
|---|---|---|---|
| standard-35 | 35% | B2B Standard | B2B Standard 35 |
| premium-25 | 25% | B2B Premium | B2B Premium 25 |
| elite-20 | 20% | B2B Elite | B2B Elite 20 |
| special-40 | 40% | B2B Special | B2B Special 40 |
Configuration Verification
Checklist
- [ ] Customer tags assigned correctly
- [ ] Segments include eligible customers
- [ ] Collections contain target products
- [ ] Coupon names exactly match tag names
- [ ] Coupon customer eligibility set to segment
- [ ] Coupon product eligibility set to collection
Common Mistakes
-
Tag/coupon name mismatch
standard-35andStandard-35are treated differently- Watch for case sensitivity and spaces
-
Segment condition errors
- Choosing "equals" instead of "contains"
- Incorrect AND/OR for multiple conditions
-
Missing coupon target settings
- Forgetting segment restriction makes it available to everyone
Adding New B2B Accounts
Once this setup is complete, adding new B2B accounts is simple:
- Tag the customer (e.g.,
standard-35) - Done!
Just adding the tag:
- Automatically adds them to the segment
- Makes that segment's coupon applicable
- Displays member pricing on the headless side
Next Steps
With Shopify configuration complete, next is the headless (Next.js) implementation. We'll look at the logic for reading tags, calculating prices, and auto-applying coupons.