Dynamically Assign Buyer Groups by Using Apex Logics

Dynamically assign guest and authenticated buyers to buyer groups for a B2B store by using custom Apex logics. When buyers visit the store pages, the Apex logic adds them to a buyer group based on the defined criteria. Assigning buyers dynamically when they visit a storefront ensures timely, personalized shopping experiences including targeted product visibility, pricing, and promotions, without manual intervention.

Required Editions

View supported editions.

Which Salesforce Commerce Product Do I Have?

Important
Important For D2C stores, this feature works only if you've configured a custom checkout experience.
  1. In the navigation sidebar, select a store from the Store dropdown.
  2. Select Settings | Store.
  3. Click the Buyer Access tab.
  4. Enable Buyer Group Extension.
  5. In the Buyer Group Extension tile, click Select Provider. Choose a provider and select your custom Apex class.
  6. Click Next and then confirm your selection.
  7. To change or remove the provider, use the dropdown menu on the extension tile.
    The Apex logic runs each time a shopper visits a page in your store and assigns them to a buyer group based on the criteria you’ve defined.