Automatic Customer Assignment
Automatically assign customers to pricelists based on their attributes - no manual assignment needed.
Overview
Automatic assignment eliminates manual customer-to-pricelist mapping. Define matching rules on each pricelist using customer and address attributes. When customers log in or update profiles, the system evaluates all active pricelists and auto-assigns matching ones.
Benefits
- Zero manual work: Customers automatically get correct pricing
- Real-time updates: Changes apply immediately on login
- New customer ready: First-time customers get pricing instantly
- Attribute-driven: Business logic encoded in rules
- Scalable: Works with 10 or 10,000 customers
How It Works
Evaluation Trigger
System evaluates pricelists when:
- Customer logs in
- Customer updates profile/address
- Customer group changes
- Admin manually triggers re-evaluation
- Cron job (if configured)
Evaluation Process
1. Get all ACTIVE pricelists for customer's website 2. Filter by date validity (from_date <= today <= to_date) 3. For each pricelist, check matching attributes: - Customer group matches? - Company name matches? - Tax ID matches? - Postcode matches? - Region matches? - Country matches? 4. If ALL filled attributes match → Assign customer to pricelist 5. Apply priority/merge logic for conflictsImportant: ALL filled attributes must match (AND logic, not OR).
Configuration
Enable Auto-Assignment
Path: Stores > Configuration > Pricesystem > Pricelist > Enable Auto Assign Customers
Setting: pricesystem/pricelist/enable_auto_assign_customers_to_pricelist
Values:
- Yes (Required): Auto-assignment enabled
- No: Only manual assignments work
Critical: Must be enabled for attribute-based matching!
Match Type
Path: Stores > Configuration > Pricesystem > Pricelist > Match Exact Type
Setting: pricesystem/pricelist/match_exact_type
Values:
Loose Matching (No - Default)
Partial string match, case-insensitive.
Examples:
- Pricelist company: "ACME"
- Customer company: "ACME Corporation" → MATCH (contains "ACME")
- Customer company: "AcMe Corp" → MATCH (case-insensitive)
Use Case: Flexible matching, forgives typos/variations.
Exact Matching (Yes)
Strict equality, case-sensitive.
Examples:
- Pricelist company: "ACME"
- Customer company: "ACME Corporation" → NO MATCH (not exact)
- Customer company: "ACME" → MATCH (exact)
- Customer company: "acme" → NO MATCH (case-sensitive)
Use Case: Precise matching, security-sensitive scenarios.
Matching Attributes
Customer Group ID
Field: customer_group_id
Source: Customer entity → group_id field
Example:
- Pricelist: group_id = 2 (Wholesale)
- Customer: group_id = 2
- Result: MATCH
Use Cases:
- Wholesale/retail pricing
- VIP tiers
- Member-only pricing
Multi-Group: Customers belong to exactly ONE group at a time. Match is simple equality check.
Company Name
Field: customer_company
Source: Customer entity → company attribute (default or custom)
Example:
Pricelist: customer_company = "ACME Corporation" Customer: company = "ACME Corporation" Match: Yes (exact) or Yes (loose if contains "ACME")Use Cases:
- B2B contract pricing
- Enterprise customers
- Corporate accounts
Best Practice:
- Use loose matching for flexibility
- Standardize company names in CRM
- Document approved variations
Tax/VAT Number
Field: customer_tax
Source: Customer entity → taxvat attribute
Example:
Pricelist: customer_tax = "DE123456789" Customer: taxvat = "DE123456789" Match: YesUse Cases:
- EU VAT-registered businesses
- Tax-exempt organizations
- Verified business accounts
Notes:
- Usually exact match (even with loose mode)
- Format-sensitive (include dashes, spaces as stored)
- Verify data quality
Postcode
Field: address_postcode
Source: Customer billing or shipping address → postcode
Example:
Pricelist: address_postcode = "90210" Customer billing: postcode = "90210" Match: YesUse Cases:
- ZIP code-based regional pricing
- Local delivery zones
- State-specific pricing
Notes:
- Checks both billing and shipping addresses
- Match if either address matches
- Loose mode: "9021" matches "90210"
Region
Field: address_region
Source: Customer address → region text field
Example:
Pricelist: address_region = "California" Customer billing: region = "California" Match: YesUse Cases:
- State/province pricing
- Regional campaigns
- Tax jurisdictions
Data Quality:
- Magento stores region as text (not ID)
- "California" vs "CA" might not match
- Standardize or use loose matching
Country
Field: address_country
Source: Customer address → country_id (2-letter ISO code)
Example:
Pricelist: address_country = "US" Customer billing: country_id = "US" Match: YesUse Cases:
- Country-specific pricing
- Currency localization
- Regulatory compliance
Notes:
- Always 2-letter ISO codes (US, DE, GB, FR, etc.)
- Exact match even in loose mode
- Most common matching attribute
Multi-Attribute Matching
AND Logic
All filled attributes must match simultaneously.
Example 1: Two Attributes
Pricelist: - customer_group_id: 2 (Wholesale) - address_country: US Customer: - group_id: 2 (Wholesale) ✓ - country: US ✓ Result: MATCH (both match)Example 2: Partial Match Fails
Pricelist: - customer_group_id: 2 (Wholesale) - address_country: US Customer: - group_id: 2 (Wholesale) ✓ - country: DE ✗ Result: NO MATCH (country doesn't match)Example 3: More Attributes
Pricelist: - customer_group_id: 2 - customer_company: "ACME" - address_country: US - address_region: "California" Customer: - group_id: 2 ✓ - company: "ACME Corporation" ✓ (loose match) - country: US ✓ - region: "California" ✓ Result: MATCH (all 4 match)Empty Attributes Ignored
Null/empty attributes are not checked.
Example:
Pricelist: - customer_group_id: 2 - address_country: NULL (not filled) Customer: - group_id: 2 ✓ - country: DE (doesn't matter, pricelist doesn't check country) Result: MATCH (only group is checked)Strategy: Leave attributes empty to broaden matching.
Common Scenarios
Scenario 1: Wholesale Customers Only
Goal: All wholesale customers get this pricelist.
Pricelist:
- customer_group_id: 2 (Wholesale)
- All other attributes: NULL
Result: Any customer in Wholesale group matches, regardless of location/company.
Scenario 2: US Wholesale Customers
Goal: Wholesale customers in US only.
Pricelist:
- customer_group_id: 2 (Wholesale)
- address_country: US
- All other attributes: NULL
Result: Must be wholesale AND in US.
Scenario 3: California Wholesale for ACME Corp
Goal: Very specific targeting.
Pricelist:
- customer_group_id: 2 (Wholesale)
- customer_company: "ACME"
- address_region: "California"
- address_country: US
Result: Only wholesale ACME employees in California, USA.
Scenario 4: EU VAT-Registered Businesses
Goal: EU businesses with VAT number.
Pricelist:
- customer_tax: "DE%" (if using wildcards) OR specific VAT
- address_country: DE/FR/IT (create multiple pricelists per country)
Result: VAT-registered businesses in target countries.
Note: Might need one pricelist per country or use group assignment instead.
Scenario 5: Regional Postcode Ranges
Goal: Specific ZIP codes get special pricing.
Challenge: Postcode ranges not directly supported.
Workaround 1: Multiple Pricelists
- Create pricelist for "90210"
- Create pricelist for "90211"
- Create pricelist for "90212"
- Assign same products/prices
Workaround 2: Custom Attribute
- Create custom customer attribute: "pricing_zone"
- Set via import/automation based on postcode
- Match on custom attribute instead
Manual Override
Group Assignment
Assign entire customer groups to pricelist, overriding attribute matching.
Path: Pricelist Edit > Groups Tab
Use Case: "All VIP members get this pricelist, regardless of attributes."
Combines with automatic: Customer can match via attributes AND be in assigned group.
Direct Customer Assignment
Assign specific customers to pricelist manually.
Path: Pricelist Edit > Customers Tab
Use Case: "Customer #12345 gets this contract pricelist (special exception)."
Overrides automatic: Manually assigned customers always get pricelist, even if attributes don't match.
Testing Automatic Assignment
Test Plan
Create test pricelist:
- Name: "Test - Wholesale US"
- customer_group_id: 2
- address_country: US
- Active: Yes
Create test customer:
- Group: Wholesale (2)
- Country: US
- Company: "Test Co"
Test assignment:
- Log in as test customer
- Check assigned pricelists (admin or API)
- Verify pricelist appears
Test exclusion:
- Change customer country to DE
- Log out, log back in
- Verify pricelist NOT assigned
Test re-assignment:
- Change customer back to US
- Log out, log back in
- Verify pricelist re-assigned
Troubleshooting
Customer Not Assigned to Pricelist
Checklist:
- ✓ Auto-assignment enabled? (
enable_auto_assign_customers_to_pricelist = Yes) - ✓ Pricelist active? (is_active = Yes)
- ✓ Date range valid? (from_date <= today <= to_date)
- ✓ Website matches? (customer on correct website)
- ✓ All attributes match? (check each filled attribute)
- ✓ Customer logged in recently? (triggers evaluation)
- ✓ Cache cleared?
Debug:
-- Check customer attributes SELECT entity_id, group_id, email FROM customer_entity WHERE entity_id = 123; SELECT company, taxvat FROM customer_entity_varchar WHERE entity_id = 123 AND attribute_id IN (...); -- Check pricelist matching attributes SELECT * FROM pricesystem_pricelist WHERE id = 456; -- Check assignments SELECT * FROM pricesystem_pricelist_customer WHERE customer_id = 123;Wrong Pricelist Assigned
Causes:
- Multiple pricelists match (check priority)
- Manual assignment overriding automatic
- Group assignment in addition to automatic
- Outdated cache
Resolution:
- Review all pricelists customer matches
- Check priority values
- Clear customer pricelist assignments (if testing)
- Re-login to trigger fresh evaluation
Loose vs Exact Matching Issues
Symptom: Customer matches when they shouldn't (or vice versa).
Check: match_exact_type configuration
Example:
- Pricelist company: "ACME"
- Customer company: "ACME Corporation"
- Loose: Matches
- Exact: Doesn't match
Fix: Choose appropriate mode or standardize data.
Best Practices
Data Quality
- Standardize company names
- Validate tax IDs on registration
- Use consistent region naming
- Encourage complete profiles
Attribute Selection
- Start with simple (group + country)
- Add attributes only when needed
- Document matching logic
- Test edge cases
Performance
- Don't create too many pricelists (100s are fine, 10,000s might be slow)
- Use group assignment for large segments
- Consider caching strategies
Documentation
- Document which attributes each pricelist uses
- Explain business rules to team
- Maintain matching logic reference
