- Fixed prices and discounts. If you have one product catalog for all buyers, without variations per-buyer or per-segment, you can use regular B2C solutions with Algolia.
- Pricing tiers. If you have customer segments with different pricing tiers, you can index the price for each segment as its own attribute. When buyers search, the prices of the segment they belong to are shown.
- Custom prices per buyer. If each buyer account has its own pricing, you can update the pricing information dynamically. When buyers search for a product, retrieve the product price for that specific buyer from a database and display it in the search results.
- Negotiable quotes. Allow your B2B buyers to request quotes and update the pricing information with the negotiated prices.
Nested attributes as pricing tiers
If you have fewer than 100 pricing levels per product, you can configure the price as a nested attribute with one price per tier or customer group.JSON
price.USD.default
.
To sort by the per-segment prices, you can use virtual replicas.
You can create up to 20 virtual replicas per index.
To create more, contact the Algolia support team.
Having many attributes increases your index size and can slow down your search.
If you have more than 100 pricing tiers or segments, it’s better to load the pricing information dynamically.
Lazy loading pricing information
If you have an extensive product catalog and many pricing levels, it’s better not to include all variations in the Algolia index. In this case, it’s best to update the pricing information dynamically. When buyers browse or search for products, you can retrieve the custom prices for that specific buyer from another database and show them in your search results.-
When a buyer searches, your client-side app or website makes two API requests:
- To your database with the prices
- To Algolia with the product information
- When presenting the search results, the product information from Algolia is augmented with the pricing information from your database.
hits
widget to include additional information in the search results with the transformItems
function.
JavaScript
Retrieve the pricing information asynchronously
If you have a large product catalog, you can retrieve the pricing information asynchronously at the same time as doing the network request to Algolia.JavaScript
Since the per-customer prices aren’t in the Algolia index, you can’t use them for sorting or filtering.
If your price variations are small enough, you could implement sorting by average price.
With this approach, you need to call two APIs with every search request:
the Algolia API for the product information and the external database for the dynamic pricing information.