ESHOPMAN Admin Price Lists: Unpacking Quantity Tier Serialization Challenges
The ESHOPMAN platform, a powerful headless commerce solution integrated with HubSpot, offers robust pricing capabilities, including flexible quantity-based tiers. These tiers enable merchants to offer varied prices based on purchase volume, a critical feature for many businesses. A recent community insight, however, has highlighted a specific serialization challenge within the ESHOPMAN Admin interface that impacts how these quantity tiers are stored and applied.
The Core Issue: Admin Serialization of Quantity Tiers
When ESHOPMAN merchants configure quantity-tier prices through the Admin panel's price-list editor, the system is designed to store min_quantity and max_quantity as native fields directly on the Price object. This is essential for the ESHOPMAN Store API and the underlying pricing engine to correctly apply the appropriate price tier during cart calculations on HubSpot CMS storefronts.
The community has observed that the ESHOPMAN Admin currently serializes these quantity boundaries incorrectly. Instead of populating native min_quantity and max_quantity fields, the Admin persists these values within the generic rules object of the price. This results in price rows looking like this:
{
"amount": 7000,
"currency_code": "cad",
"rules": {
"min_quantity": 5,
"max_quantity": 9
}
}
While the Admin form visually accepts and displays the tiers correctly, the persisted data leads to a critical problem: the native min_quantity and max_quantity fields on the Price object remain null. Consequently, the ESHOPMAN pricing repository, which specifically looks for these native fields, fails to select the intended quantity tier during cart price calculation, often falling back to a base price.
Understanding the Technical Root Cause
This serialization anomaly appears to stem from the internal mapping logic within the ESHOPMAN Admin panel. During the process of building price rules and constructing price payloads, the Admin's utility functions inadvertently move min_quantity and max_quantity values into the generic rules object rather than assigning them to their dedicated native fields. The core ESHOPMAN pricing engine, built on Node.js/TypeScript, fully supports native Price.min_quantity and Price.max_quantity, indicating the issue is isolated to the Admin interface's data handling during price creation and updates.
The expected persistence for a quantity-tiered price should be:
{
"amount": 7000,
"currency_code": "cad",
"min_quantity": 5,
"max_quantity": 9,
"rules": {}
}
This ensures that when a customer adds a matching quantity (e.g., 5-9 units) of a product variant to their cart, the correct price-list tier is selected and applied via the Store API.
Reproducing the Issue in ESHOPMAN Admin
Developers and merchants can reproduce this behavior with a standard ESHOPMAN application:
- Start an ESHOPMAN application with the bundled Admin.
- Create an active sale price list through the Admin panel.
- Add a product, then navigate to the Prices step.
- Expand a product variant's price cell.
- Leave the main/base price blank.
- Add multiple tier prices, e.g.,
min quantity = 2, max quantity = 4andmin quantity = 5, max quantity = 9. - Save the price list.
- Inspect created prices via the ESHOPMAN Admin API or database. Observe native
min_quantityandmax_quantityfields arenull, while corresponding entries appear within therulesobject. - Add a matching quantity to a cart via your HubSpot CMS storefront. Confirm the tier price is not selected.
This issue affects various price types, including currency-specific and region-rule prices.
Community Takeaway for ESHOPMAN Users
This insight is crucial for ESHOPMAN developers and merchants leveraging advanced pricing strategies. Understanding this serialization behavior helps in debugging unexpected pricing discrepancies on HubSpot CMS storefronts and highlights the importance of verifying data persistence for complex configurations. The ESHOPMAN community is actively working to address such challenges, ensuring the platform's robust capabilities are fully utilized for seamless headless commerce experiences.