This page has moved and will be redirected soon. See Migrated topics for the complete list.
Adobe Commerce only. Learn more.

Install B2B

The B2B for Adobe Commerce extension is only available for Adobe Commerce v2.2.0 or later. You must install it after installing Adobe Commerce.

For Adobe Commerce on cloud infrastructure projects, see Set up Magento B2B module in the Cloud Guide.

  1. Change to your Magento installation directory and enter the following command to update your composer.json file and install the B2B for Adobe Commerce extension:

    1
    
    composer require magento/extension-b2b:<version>
    

    You must specify a Compatible B2B extension version in the command, which can be found in the left column of the compatibility table.

    If you get an error when trying to install the B2B module for a local instance of Adobe Commerce for example:

    1
    
    [InvalidArgumentException] Could not find a matching version of package magento/extension-b2b.
    

    Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).

    If not already defined globally in your COMPOSER_HOME, you will need to create an auth.json file in the Magento root directory and add the following code, using the actual values of your public_key and private_key for username and password:

    1
    2
    3
    4
    5
    6
    7
    8
    
    {
       "http-basic": {
          "repo.magento.com": {
             "username": "<public_key>",
             "password": "<private_key>"
          }
       }
    }
    
  2. When prompted, enter your authentication keys. Your public key is your username; your private key is your password. If you have stored your public and private keys in auth.json, you won’t be asked to enter them here.

  3. Run the following commands after Composer finishes updating modules:

    1
    
    bin/magento setup:upgrade
    
    1
    
    bin/magento setup:di:compile
    
    1
    
    bin/magento setup:static-content:deploy -f
    
    1
    
    bin/magento cache:clean
    

In Production mode, you may receive a message to ‘Please rerun Magento compile command’. Enter the commands above. Magento does not prompt you to run the compile command in Developer mode.

After completing the installation, you must follow the post-installation steps.

Configure

After installing the B2B for Adobe Commerce extension, follow these instructions to launch B2B for Adobe Commerce.

Start message consumers

The B2B for Adobe Commerce extension uses MySQL for message queue management. The following table describes the required message consumers that you must start to use B2B features:

Consumer Description
sharedCatalogUpdatePrice Updates price for each product in a shared catalog. Required when the Shared Catalogs option is enabled in the Admin system configuration settings.
sharedCatalogUpdateCategoryPermissions Updates categories assigned to a shared catalog category. Required when the Shared Catalogs option is enabled in the Admin system configuration settings.
negotiableQuotePriceUpdate Updates prices for negotiable quotes. Required when the Quotes option is enabled in the Admin system configuration settings.
purchaseorder.toorder Converts purchase order to order. Required when the Purchase Order option is enabled in the Admin system configuration settings.
purchaseorder.transactional.email Send purchase order emails. Required when the Purchase Order option is enabled in the Admin system configuration settings.
purchaseorder.validation Validates purchase order against relevant approval rules. Required when the Purchase Order option is enabled in the Admin system configuration settings.
quoteItemCleaner Deletes invalid or inactive price quotes when a product is deleted from the catalog or removed from the cart. Required when the Quotes option is enabled in the Admin system configuration settings.
inventoryQtyCounter Asynchronously corrects the stock index after an order is placed or a product is removed. Required when the Use deferred stock update option is enabled in the Admin configuration settings. See Performance Best Practices.
async.operations.all Creates messages for each individual task of a bulk operation, such as importing or exporting items, changing prices on a mass scale, and assigning products to a warehouse. Required when the Admin bulk operations option is set to Run asynchronously in the Admin system configuration settings.
  1. Start each consumer separately:

    1
    
    bin/magento queue:consumers:start <consumer_name>
    

    For example:

    1
    
    bin/magento queue:consumers:start sharedCatalogUpdatePrice
    

Append & to the command to run it in the background, return to a prompt, and continue running commands. For example: bin/magento queue:consumers:start sharedCatalogUpdatePrice &.

Refer to Manage message queues for more information.

Add message consumers to cron

You may also add these two message consumers to the cron job (optional). For this, add these lines in your crontab:

1
2
* * * * * ps ax | grep [s]haredCatalogUpdateCategoryPermissions >>/dev/null 2>&1 || nohup php /var/www/html/magento2/bin/magento queue:consumers:start sharedCatalogUpdateCategoryPermissions &
* * * * * ps ax | grep [s]haredCatalogUpdatePrice >>/dev/null 2>&1 || nohup php /var/www/html/magento2/bin/magento queue:consumers:start sharedCatalogUpdatePrice &

Specify parameters for message consumers

Depending on your system configuration, to prevent possible issues, you may also need to specify the following parameters when starting the services:

  • --max-messages: manages the consumer’s lifetime and allows you to specify the maximum number of messages processed by the consumer. The best practice for a PHP application is to restart long-running processes to prevent possible memory leaks.

  • --batch-size: allows you to limit the system resources consumed by the consumers (CPU, memory). Using smaller batches reduces resource usage and, thus, leads to slower processing.

Enable B2B features in Admin

After installing the B2B for Adobe Commerce extension and starting message consumers (if you want to enable the Shared Catalog module), you must also enable B2B modules in Admin.

If you enable the Shared Catalog module, you must also enable the Company module. The Quick Order and Requisition Lists modules can be enabled/disabled independently.

  1. Access the Admin and click Stores > Settings > Configuration > General > B2B Features.

  2. Select Yes from the drop-down menus to enable B2B features:

    Enable B2B features

  3. Click Save Config.

Looking for more documentation? Checkout the B2B Developer Guide and User Guide.