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 pickerAnchor 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
true, then display the following:
- The current company and location of the customer.
customer.company_available_locationshas a size greater than 1, then display a list of the currently unselected locations.
Show content based on company or locationAnchor 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.
Show content to B2B customers onlyAnchor link to section titled "Show content to B2B customers only"
Dedicated B2B stores might want to show certain online store content only to verified B2B customers.
You might want to hide the following elements from customers who aren't logged in as a B2B customer:
- Product prices
- The cart icon in the header
- Add to cart buttons
- Other calls to action in the product page
You can use the Liquid
customer.b2b? property to render content only for verified B2B customers. In this example,
customer.b2b? is used to conditionally hide the product price:
Where logged out customers would usually see pricing, you can instead show a prompt to log in:
You can also use this property to render content only for logged out customers. In this example,
customer.b2b? is used to conditionally show an inquiry form.