Today we’re going to talk about how pricebook imports work in Salesforce B2C Commerce.
As you probably know, when we create a pricebook, we assign it to a site. That pricebook can also have a parent pricebook, and thanks to this inheritance system, we can define things like promotional prices. For example, the same product might have two prices across different pricebooks that are connected. This lets the system display a sale price with the original one crossed out, all thanks to pricebook inheritance.
We can also define the validity period for each product price. That means we can set a price to be either always active, or only valid within a specific date range — with a start and end date. Based on the current date, the system will show the correct price accordingly.
In some cases, there may be multiple prices that overlap in time. If that happens, Salesforce B2C Commerce will choose the one with the most restricted date range — meaning the most specific one.
So, based on all of this, it’s important to load prices into the platform properly. It’s pretty uncommon to manage prices manually through Business Manager — unless you only have a small catalog. In that case, managing prices directly in the Price Books section of Business Manager might be fine.
But in most cases, with larger catalogs, prices are managed from external systems — like SAP or similar platforms. These tools typically generate a file (CSV, XML, etc.), or send the data through a middleware or MuleSoft. That data then gets converted into an XML file that Salesforce understands.
Once we have this Salesforce-compatible XML, a job usually processes and imports it into the system. It's also possible to upload prices using APIs, so don’t forget about that option. But in most projects, the standard flow is that an external tool prepares a file, possibly through a middleware, which ends up generating the XML we want.
Once that’s in place, the file is uploaded to our system — often using a scheduled nightly job.
Let’s talk more about that job. When we import a pricebook using a job, we need to define the source file and, more importantly, the import mode we want to use. There are four modes available: update, replace, merge, and delete. It’s really important to understand how each mode works because the result depends on what we choose.
Update: only updates existing records — it doesn’t create anything new.
Merge: updates existing records and also adds new ones.
Replace: deletes all existing records and then creates the new ones from scratch.
Delete: deletes the records that are defined in the XML file.
So, depending on how the source system works, we need to make sure everything is properly synchronized with Salesforce B2C Commerce so prices appear exactly as we expect.
Recently, I worked on a project where the external system was sending a full pricebook every day, expecting it to be deleted and recreated each time. Unfortunately, this logic doesn't fit any of the four import modes directly.
Here's the solution we implemented:
First, we enabled a feature switch called Enable High Scale Pricebooks. This makes pricebooks read-only from Business Manager, but it speeds up import and access because the system works purely with files — no manual edits.
Then, we created a job with several steps:
The first step downloads the new pricebook files from the external system.
The second step deletes the previous day’s prices using the delete mode.
Right after that, we import the new file using merge, update, or replace — it doesn’t really matter here.
This guarantees that we clear the old prices first and load the new ones correctly.
If any of the steps fail, we abort the entire process to keep the system clean and consistent.
The final step is a reindexing, although in this setup with High Performance Pricebooks, it might not be strictly necessary. Once this is done, the automated replication takes care of pushing prices to the production instance.
What do you think of this solution?
Have you come across a similar use case for pricebook imports in any of your projects?
PS: Have you already checked out our two latest advanced courses?
They might be exactly what you need to level up: