HowTo: Manage business unit specific prices via data import

Edit on GitHub
B2B only

You can apply the approaches described in this document only if your project follows the B2B model because the merchant custom prices feature used for these approaches is only for B2B. Also, the behavior described in this document is not compatible with Marketplace.

Let’s assume you have a default price for products, and you have merchants for whom you want to make a certain percentage discount from the default price. You can do this by adding merchant custom prices via the Back Office or by data import. This document explains how you can manage the merchant custom prices with data import.

Data importers for merchant custom prices

In the Spryker B2B Demo Shop, there are two data importers used for managing the merchant custom prices:

Assigning merchant custom prices via data import

To assign special product prices to merchants, you can do the following:

  1. In the merchant_relationship.csv file, define the merchant relation keys. For details, see the example in the Spryker B2B Demo Shop.
  2. To import merchant relations, run
console data:import merchant-relationship
  1. For each merchant relationship, create separate data import CSV files. For example, you can have a file price-product-merchant-relationship-mr001.csv, where mr001 is the merchant relation key you defined in the previous step. In this file, you specify product prices for this specific merchant.

  2. Then, you can do one of the following:

    • Set specific default prices for this merchant manually. For example, if you provide a 20% discount on a product for the merchant relation mr001 and change the default price for the product in the product price file, you have to go to the price-product-merchant-relationship-mr001.csv file and change the price for this merchant as well. Because changing the general default product price does not automatically change the merchant custom price for this product. Thus, with every change of the default product price, you have to manually change every merchant custom price of this product. This option can work for a relatively small amount of products and merchants you provide the specific prices for. For big amount of this data, to avoid too much manual work, we recommend considering the next option.
    • Create a custom script that can automatically adjust merchant-specific prices upon the default price change. In your ERP, you might have the base, or default price, defined along with the percentage of discount for your merchants. The script would handle the relation between the default price and the discount for merchants to define the specific price for the merchants. For example, if the percentage of discount for a merchant is 20%, the script generates the price-product-merchant-relationship-mr001.csv file with the prices for this mr001 merchant. In this example, the price is the default price minus 20%. This approach is optimal for big amount of data. However, its main drawback is that you need some development effort and that the script runs and processes data outside of the Spryker platform.
  3. To import product prices for merchant relations, run

console data:import product-price-merchant-relationship