Support B2B customers in your theme
Many merchants conduct business-to-business (B2B) commerce, where they sell directly to other companies.
To help manage B2B transactions, merchants can create companies. A company can be associated with one or more customers, and can have one or more locations. For an individual transaction, a B2B customer must select a location for the transaction to be associated with.
In this tutorial, you'll learn how to support B2B customers with a location picker.
To support B2B customers in your theme, you'll use the following objects and object properties that contain B2B information:
Implementing a company location picker
Anchor link to section titled "Implementing a company location picker"If the current customer is a B2B customer, then you should give them the ability to choose the company location that they're purchasing for with a location picker.
Your location picker code should do the following:
- Check whether the customer is a B2B customer using
customer.b2b?
- If
customer.b2b?
istrue
, then display the following:- The current company and location of the customer.
- If
customer.company_available_locations
has a size greater than 1, then display a list of the currently unselected locations.
Show content based on company or location
Anchor link to section titled "Show content based on company or location"You can show content conditionally based on the current company or location of the customer.