WooCommerce B2B

Current version: 3.1.5



# Introduction
Get started with WooCommerce B2B, the best seller WordPress plugin for your B2B needs.

WooCommerce B2B is a WordPress/WooCommerce extension that solves all the different challenges of a B2B shop, introducing many new features to manage your needs.

In a single suite, all the features that an e-commerce can require to open its horizons to wholesale, but without detracting from the classic B2C needs.

You can find an always updated version of this documentation here.

# Requirements
Before starting, check that you have the minimum characteristics to ensure the correct functioning of WooCommerce B2B.

  • WordPress: version 5.0 or above
  • WooCommerce: version 4.0 or above
  • PHP: version 5.6 or above
# Quick start
Get started by using WooCommerce B2B by configuring your context.

  1. Configure general plugin options

    Define your store's behavior and rules by configuring WooCommerce B2B to your specific needs:

    WooCommerce -> Settings -> {B2B tab}
    You can find more information on each individual option below in this documentation, in Plugin options section.
  2. Create groups you need

    Create one or more groups, depending on your project, useful for grouping your customers and define specific rules for each group:

    Users -> Add new
    By default, WooCommerce B2B generates a special group called GUEST, useful for identifying all users without any group or not registered / logged in and assigning specific rules. Do not delete this group and do not consider it a generic group.
  3. Assign customers to group

    Decide which group to assign your customers to, in order to apply the rules configured for each group. You can do this in several ways:


    • By individually assigning each customer to a group in user profile edit page

      Users -> All Users -> {Edit user profile}

    • By massively assigning customers to a group in user list

      Users -> All Users -> {Bulk actions}

    By default, WooCommerce B2B allows you to assign groups only to users with the predefined role "customer". If you want to extend this behavior to custom roles, take a look at the appropriate wcb2b_has_role_customer hook.
  4. Configure products

    For each product, you can apply group-specific rules. You can do this in several ways:


    • By individually settings each single product in product edit page

      Products -> All Products -> {Edit product}

    • By massively updating products using Import/Export tools

      Products -> All Products -> {Import/Export button}

    To know more about WooCommerce Import/Export tools, please read Official documentation.
# Installation
There are multiple ways to install WooCommerce B2B, here is a quick step-by-step guide to do this.

Manual mode
  1. Unzip "woocommerce-b2b.zip" file
  2. Login in your FTP area
  3. Upload the entire "woocommerce-b2b" folder to the "/wp-content/plugins/" directory
  4. Login in your WordPress site
  5. Go to "Plugins > Installed Plugins" page
  6. Click "Activate" link at WooCommerce B2B
Classic WordPress mode
  1. Login to your WordPress Dashboard
  2. Go to "Plugins > Add New" page
  3. Click "Upload Plugin" button at the top
  4. Select "woocommerce-b2b.zip" file and click "Install now" button
  5. Once installed, click "Activate" link

Update

To install new release, simply download it from your Envato account, unzip the archive and replace the entire folder:

  • wp-content/plugins/woocommerce-b2b/

with the new one by using an FTP client (such as FileZilla).

Note: Don't uninstall the previous version! By uninstalling you will lose all plugin related settings.
Note: Before to update, please read carefully changelog and this documentation, to verify the changes of new release.
Note: Before to update to latest version, please be sure to have a complete backup (filesystem and database) to avoid any problems or errors.

Update database process

By updating the plugin to a new release, you will be prompted to perform a database update.
This update is necessary for the correct functioning of the new release, so it is strongly recommended to do it.

All processes to be performed for the update are performed in the background and can be viewed in the WordPress section dedicated to scheduled actions:

Tools -> Scheduled Actions

and associated with the hook wcb2b_run_update_callback.


# Plugin options
WooCommerce B2B introduces a large number of features, here a complete list with description to guide you in the configuration.

Main options
WooCommerce > Settings > Payments tab
WooCommerce > Settings > Emails tab

Invoice payment payment gateway
Description

"Invoice payment" payment gateway allow your customers to checkout without immediate payment. It can be enabled based on shipping method chosen by customer.

Once customer places order, he will receive an email notifying him to expect an invoice.

Note: invoice payment method text can be customized in WooCommerce settings page (Payments tab).
Note: WooCommerce B2B does not generate invoices itself (it is not an invoicing plugin). You will have to manually send invoices to customers. WooCommerce B2B is compatible with most invoicing plugins (ie: WooCommerce PDF Invoices & Packing Slips).
Screenshots

  • Checkout page
Purchase order payment gateway
Description

"Purchase order" payment gateway adds a field to checkout where your customer enters in their purchase order number (provided by you directly to customer in a manual agreement).

Note: purchase order method text can be customized in WooCommerce settings page (Payments tab).
Screenshots

  • Checkout page
Quotations payment gateway and emails
Description

"Quotation request" gateway allow your customers to ask for quotations. It can be enabled based on shipping method chosen by customer.

In the customer's my-account area, a special "Quotations" section is displayed, listing all of his requests for quotation.

If the customer chooses "Quotation request", he receives an email summarizing his request and the order is saved with the status "On quote".

The admin of the site can manage the request, modifying the quotation just like any other order and finally conclude by putting the status "Quoted". In this way, the customer receives an email notification that the quote is ready and can decide to make the payment by clicking the "Pay" button directly from his my-account area. In this way, the quotation becomes an order and can be managed as such.

Note: quotations email can be customized in WooCommerce settings page (Emails tab).
Note: quotations payment method text can be customized in WooCommerce settings page (Payments tab).
Note: on new quotation request, products stock is not reduced. Stock reduction is done on "Quoted" status.
Screenshots

  • Checkout page
  • My-account page (list)
  • My-account page
    (quotation details)
  • On quote email
  • Quoted email
  • Admin new quote email
  • Quotation email
    customization
  • Quotation payment
    method customization
Workflow
A full integrated system, to convert quote requests into orders in few clicks! Discover how quotations system works and how it's simple for you!

WooCommerce B2B quotation system is an innovative way to administrate customers quotation requests that allow to simply manage them.

To better understand how it works and what are the activities he carries out, here is a simple graphic of his workflow, click on it to enlarge.


Settings page Settings
WooCommerce > Settings > B2B > Settings tab

Restricted catalog
Description

It limits the visibility of catalog only to customers who are logged in, redirecting guest users to the login page when they try to reach a WooCommerce page.

It also takes care of removing WooCommerce pages for guest customers from menus, widgets, lists.

Here hidden pages list:

  • Product pages
  • Product category pages
  • Product tag pages
  • Shop
  • Cart
  • Checkout
  • Pay page
  • Thanks page
  • Edit address page
  • View order page
  • Terms page
Customization

You can customize redirect or restricted pages by using dedicated hooks:

Quick order page
Description

Allow your customers to make large orders simply with a CSV file upload.

WooCommerce B2B automatically create a new page named "Quick orders" as draft with the proper shortcode [wcb2bquickorder].

CSV file needs these properties:

  • it must have no header row
  • separator must be ";" (semicolon)
  • it needs at least two columns:
    • SKU: it contains product SKU to add to cart
    • QUANTITY: it contains product quantity to add to cart

To enable, simply publish it and insert into your desired menu.

Note: if there are multiple columns (for example, the title, to make it easier for your customers to recognize), it doesn't matter. Quick order only considers the first two columns (SKU and Quantity).
Note: on CSV upload, please check messages displayed to verify that there are no errors in the file.
Note: when CSV uploaded, previous cart will be empty.
Screenshots

  • Quick order page
Hide prices
Description

Removes the possibility of viewing the prices of the products for non-logged in customers, replacing the price with the message "Please, login to see prices and buy" linked to the login page.

It also takes care of making the products not purchasable for customers who are not logged in, so no purchase can be made by guest customers.

Screenshots

  • Product page
  • Shop page
Recommended retail price (RRP)
Description

Show default product regular price as recommended retail price (RRP) to customers belonging WooCommerce B2B groups (excluding GUEST default group) in single product page.

Screenshots

  • Product page
Barcode
Description

Show product barcode in single product page.

Customization

You can customize barcode displaying by using dedicated hooks:

Screenshots

  • Product page
  • Admin product page
Prices rules
Description

Price rules allow you to offer your customers different prices depending on the group they belong to. For more flexibility, you can apply several options:

  1. Show prices assigned to single product: in each product, you can define a dedicated price (regular and sale) for each customer group. When a customer logs in, they will see the price dedicated to the group they belong to.
  2. Show default prices discounted by customer group percentage: you can define a discount percentage for each group that will be applied to all products. When a customer logs in, they will see the default WooCommerce price discounted by the percentage assigned to the group they belong to.
  3. Show prices assigned to single product discounted by customer group percentage: a combination of the previous options, the discount percentage will be applied no longer on the default price of WooCommerce, but on the dedicated price.
Note: if the dedicated price is not present for a product, the default WooCommerce price will be considered.
Examples

Here are some simulated scenarios, to understand how the price rules are applied in the different combinations.

  • Groups:
    • Partners, with 15% discount
    • Suppliers, without percentage discount
    • Resellers, with 10% discount
  • Customers:
    • Customer1, assigned to Partners group
    • Customer2, assigned to Suppliers group
    • Customer3, assigned to Resellers group
    • Customer4, no group
  • Products:
    • Product1
      • Default price 100
      • Partners dedicated price 90
      • Suppliers dedicated price 80
      • Resellers dedicated price 70
    • Product2
      • Default price 200
      • No Partners dedicated price
      • Suppliers dedicated price 180
      • Resellers dedicated price 170
    • Product3
      • Default price 300
      • No Partners dedicated price
      • No Suppliers dedicated price
      • Resellers dedicated price 270
Option1 Option2 Option3
Customer1
(Partners)
Product1 90
(Partners dedicated price)
85
(Default price - 15%)
76,5
(Partners dedicated price - 15%)
Product2 200
(no Partners dedicated price => default price)
170
(Default price - 15%)
170
(no Partners dedicated price => default price - 15%)
Product3 300
(no Partners dedicated price => default price)
255
(Default price - 15%)
255
(no Partners dedicated price => default price - 15%)
Customer2
(Suppliers)
Product1 80
(Suppliers dedicated price)
100
(Default price - 0%)
80
(Suppliers dedicated price - 0%)
Product2 180
(Suppliers dedicated price)
200
(Default price - 0%)
180
(Suppliers dedicated price - 0%)
Product3 300
(no Partners dedicated price => default price)
300
(Default price - 0%)
300
(no Suppliers dedicated price => default price - 0%)
Customer3
(Resellers)
Product1 70
(Resellers dedicated price)
90
(Default price - 10%)
63
(Resellers dedicated price - 10%)
Product2 170
(Resellers dedicated price)
180
(Default price - 10%)
153
(Resellers dedicated price - 10%)
Product3 270
(Resellers dedicated price)
270
(Default price - 10%)
243
(Resellers dedicated price - 10%)
Customer4
(no group)
Product1 100
(Default price)
100
(Default price)
100
(Default price)
Product2 200
(Default price)
200
(Default price)
200
(Default price)
Product3 300
(Default price)
300
(Default price)
300
(Default price)
Note: WooCommerce B2B provide by default a GUEST group. Guest group dedicated prices will be applied to guest customers or to customers without a group, instead of WooCommerce default prices. WooCommerce default prices are used only as fallback (if dedicated price is missing, or as base to calculate percentage discount when "Show default prices discounted by customer group percentage" is enabled.
Remember: please don't remove GUEST group and don't change it's logical meaning, for example renaming it to use as a B2B group.
Already bought
Description

If customer has already purchased a product in the past, an "Already bought" message is displayed on product detail page after "Add to cart" button.

Screenshots

  • Product page
Total sales
Description

Show the total number of product sales on the product detail page, after meta.

Screenshots

  • Product page
Shippings tab
Description

Add an additional tab with shippings summary table on product detail page.

Screenshots

  • Product page
Show discount
Description

Allow customers to see their group assigned percentage discount. There are two different options, independent of each other:

  • Customers can view discount amount assigned to them in their own account area: display group percentage discount in customer my-account area
  • Customers can view discount amount assigned to them in single product page: display group percentage discount in each product page
Note: it requires "Price rules" option in WooCommerce B2B settings page is set on "Show default prices discounted by customer group percentage" or "Show prices assigned to single product discounted by customer group percentage".
Customization

You can customize redirect by using dedicated hooks:

Screenshots

  • Product page
  • My account page
Display prices tax
Description

Allow to set price tax behavior by group. Display prices including tax or excluding tax according to customer group settings.

Note: it requires "Enable taxes" option in WooCommerce settings page (general tab) is enable. It requires "Tax rates" option in WooCommerce settings page (Tax tab) is setup. When enabled, override options "Display prices in the shop" and "Display prices during cart and checkout" behaviour in "Tax" tab under WooCommerce settings.
Screenshots

  • Product page
Tax exemption by country
Description

Apply the tax exemption in the shopping cart for customers belonging to a group (not GUEST) with billing country among those chosen.

Note: it requires "Enable taxes" option in WooCommerce settings page (general tab) is enable. It requires "Tax rates" option in WooCommerce settings page (Tax tab) is setup.
Page visibility
Description

Enable pages visibility management. You can decide to view the pages according to the customer group.

Hidden pages will throw a 404.

Customization

You can decide to perform a redirect instead of 404 or decide always visibile pages, by using dedicated hooks:

Compatibility

If you make use of third part plugin WPML, please be sure to set this meta as a copy for the pages.


Product categories visibility
Description

Enable product categories visibility management. You can decide to view the product categories according to the customer group. If a category is hidden, the products belonging to the category will also be hidden.

Hidden product categories and their products are also removed from menus, widgets and lists.

Screenshots

  • Shop page
Redirect on page
Description

When customers reach not visible product category or product, they will be redirected on 404 pages or on a WordPress page of your choice.

Email address for invoices
Description

Add an additional field in which customers can communicate email address where they prefer to receive invoices.

Multiple options to enable email address for invoices management:

  • Add email address for invoices field to billing address: Email address for invoices field is added to billing address (in checkout form and in customer profile page), order emails, order details and registration forms (if "REGISTRATION FORMS" option enabled), both in the frontend and in the backend.
  • Make email address for invoices field required: decide if the invoice email field must be mandatory or optional.
Screenshots

  • Checkout page
  • Admin order details
  • Admin customer page
Vat number
Description

Multiple options to enable VAT management:

  • Add VAT number field to billing address: VAT number field is added to billing address (in checkout form and in customer profile page), order emails, order details and registration forms (if "REGISTRATION FORMS" option enabled), both in the frontend and in the backend.
  • Make VAT number field required: decide if the VAT number field must be mandatory or optional.
  • Enable VAT number VIES validation for EU customers: enable VAT number VIES validation for EU customers. VIES validation works with third part WebService. VIES validation requires PHP SOAP extension, please check it is available on your server (contact your server provider to know more).
Customization

You can customize redirect by using dedicated hooks:

Screenshots

  • Checkout page
  • VIES validation
  • Admin order details
  • Admin customer page
Min purchase amount
Description

Allow to set a minimum purchase amount by group. If the minimum amount is not reached, a warning message is displayed in checkout page.

There are two different options, independent of each other:

  • Enable minimum purchase amount by group: enable minimum purchase amount by group management
  • Display a message in the shopping cart page to alert that minimum amount isn't reached yet: if the minimum amount is not reached, a warning message is displayed in the cart.
  • Remove "Proceed to checkout" button in shopping cart if customer doesn't reach the minimum amount: if the minimum amount is not reached, customer cannot proceed to checkout page.
Screenshots

  • Cart page
  • Checkout page
Show unpaid amount
Description

Allow customers to see unpaid total orders amount in their own account area.

Screenshots

  • My account page
Show customer group
Description

Allow customers to see group assigned to them in their own account area.

Customization

You can customize redirect by using dedicated hooks:

Screenshots

  • My account page
Moderate registration
Description

Allow to set moderate registration by group. When a customer register, if his group (choosed or default) has "Moderate registration" option enabled, prevent autologin and customer can login only after administrator approval. On approval, customer receive an email notification which warns that your account is active.

Note: active account email can be customized in WooCommerce settings page (Emails tab).
Screenshots

  • Registration page
  • Active account email
  • New account email
  • Active account
    email customization
  • Admin customer page
Registration forms
Description

Extend WooCommerce default registration forms with WooCommerce default billing fields.

Note: it requires "Allow customers to create an account on the 'My account' page" option in WooCommerce settings page (Accounts & Privacy tab) is enabled.
Screenshots

  • Registration page
Registration notice
Description

Send email to admin on every new customer account registration. Very useful if moderate registration option is enabled.

Default group
Description

Assign automatically customer to a group on registration. Also available these special options:

  • Allow to choose: add a dropdown menu in registration page, customers can choose group among those available

Screenshots

  • Registration page
Quotation endpoint
Description

Allow to change my-account page quotations list endpoint slug.

Settings page Status
WooCommerce > Settings > B2B > Status tab

Templates override
Description

Summary of templates status, with a list of templates overridden by your parent/child theme and a warning message that they need to be updated.

Screenshots

  • Status tab

Group options
Users > All Groups > {Group}

Disable payment methods for this group
Description

Select all payment methods you want to disable for customers assigned to group.

Screenshots

  • Admin group page
Disable shipping methods for this group
Description

Select all shipping methods you want to disable for customers assigned to group.

Screenshots

  • Admin group page
Terms and Conditions for this group
Description

Enter a dedicated Terms&Condition disclaimer to display to customers assigned to group.

To use dedicated Terms&Conditions, you can use the shortcode [wcb2bgrouptermsconditions]; in this way, you can also integrate in default global Terms&Conditions text.

Customization

You can customize redirect by using dedicated hooks:

Screenshots

  • Admin group page
Percentage discount
Description

As described in "Price rules" option, each group can have a global percentage discount to apply to all product. You can enter desired percentage discount.

Note: it requires "Price rules" option in WooCommerce B2B settings page is set on "Show default prices discounted by customer group percentage" or "Show prices assigned to single product discounted by customer group percentage".
Screenshots

  • Admin group page
Packaging fee
Description

Packaging fee is added to customer cart, as additional fee to process order.

It can be set as fixed amount or percentage on cart amount.

Screenshots

  • Admin group page
  • Checkout page
Min purchase amount
Description

The minimum amount of the cart to be able to complete the order. If the customer does not reach the minimum cart amount, he cannot complete his purchase.

Note: it requires "Min purchase amount" option in WooCommerce B2B settings page is enabled.
Screenshots

  • Admin group page
  • Cart page
  • Checkout page
Tax exemption
Description

Allow customers assigned to group to purchase without taxes (zero tax class).

Note: it requires "Enable taxes" option in WooCommerce settings page (general tab) is enable. It requires "Tax rates" option in WooCommerce settings page (Tax tab) is setup.
Screenshots

  • Admin group page
Display prices (tax)
Description

Allow customers in group to see prices including tax or excluding tax.

Note: it requires "Enable taxes" option in WooCommerce settings page (general tab) is enable. It requires "Tax rates" option in WooCommerce settings page (Tax tab) is setup.
Screenshots

  • Admin group page
  • Product page
Price suffix
Description

Define text to show after your product prices. This could be, for example, "inc. Vat" to explain your pricing. You can also have prices substituted here using one of the following: {price_including_tax}, {price_excluding_tax}.

Note: it override default WooCommerce price suffix option.
Screenshots

  • Admin group page
  • Product page
Moderate registration
Description

Allow customers assigned to group to login only after administrator approval.

Note: it requires "Moderate registration" option in WooCommerce settings page (general tab) is enable.
Screenshots

  • Admin group page

Customer options
Users > All Users > {User}

User group
Description

Assign a group to customer.

Screenshots

  • Admin user page
User status
Description

Enable/Disable user profile. If status is "Inactive", customer cannot login and purchase.

Note: it requires "Moderate registration" option in WooCommerce B2B settings page is enabled.
Screenshots

  • Admin user page
Unpaid amount limit
Description

Prevents this customer from placing further orders if they have reached a unpaid total orders amount equal to or greater than the set limit. Set 0 to give no limit.

Screenshots

  • Admin user page
  • Checkout page

Order options
WooCommerce > Orders > {Order}

External invoice number
Description

Store invoice number, generated by external software (ie: ERP).

Screenshots

  • Admin order page

Product options
Products > All Products > {Product}

Hide price on single product/variation by group
Description

WooCommerce B2B has a global option "Hide price" to remove prices to all products, without exception.

This option, on the other hand, allows you to manage the visibility of the price for each individual product or variation by specific group.

Note: WooCommerce B2B by default show all product variations (also not available ones). Note: global "Hide prices" option in WooCommerce B2B settings page override and disable this specific option.
Customization

You can customize always visible variations settings by using dedicated hooks:

Screenshots

  • Admin product page
Hide stock on single product/variation by group
Description

It allows you to manage the visibility of the stock for each individual product or variation by specific group.

Note: it depends on the "Stock display format" option in the WooCommerce settings page, in the "Products -> Inventory tab". Note: it require that product has "Manage stock?" option enabled.
Screenshots

  • Admin product page
Barcode
Description

Set a product barcode to display in frontend product details page.

In variable products, you can set both a global barcode (in inventory tab) and a single barcode for each variation (in variation tab).

Note: it requires "Barcode" option in WooCommerce B2B settings page (general tab) is enable.
Screenshots

  • Admin product page
Product dedicated and tier prices
Description

Set for each product custom price lists according to customer group.

For each group created, there is an additional section: {GROUP_NAME} GROUP PRICES

In this section, it's possible to enter:

  • Regular price: dedicated regular price for group
  • Sale price: dedicated sale price for group

In addition, in this section it is possible to enter the discounted prices for each group (tier group prices): by clicking on the "Add tier price" button, a new row is inserted, in which it is sufficient to enter:

  • Min quantity minimum quantity to which the discounted price applies
  • Final discounted price the discounted price applied for the max quantity
Examples

Here are some simulated scenarios, to understand how the tier group prices are applied in the different combinations.

  • Product configuration
    • Min quantity: 5 - Final discounted price: 100
    • Min quantity: 10 - Final discounted price: 90
    • Min quantity: 15 - Final discounted price: 80
    • Min quantity: 20 - Final discounted price: 70
  • If customer add to cart quantity 5, he pay 100 for each
  • If customer add to cart quantity 6, he pay 10 for each
  • If customer add to cart quantity 12, he pay 90 for each
  • If customer add to cart quantity 20, he pay 70 for each
  • If customer add to cart quantity 99, he pay 70 for each
Screenshots

  • Admin product page
    (simple)
  • Admin product page
    (variable)
  • Product page
Package quantity by group
Description

Force customers to purchase product by pack increment. Insert how much products are in every pack. Quantity can be set by group.

This setting is applied on each product quantity selector in shop (product pages, category pages, cart)

In product page, a message appears to inform you that the product can only be purchased in predefined stocks.

Customization

You can customize redirect by using dedicated hooks:

Screenshots

  • Admin product page
  • Product page
Minimum quantity by group
Description

Force customers to purchase at least quantity of a product. Quantity can be set by group.

This setting is applied on each product quantity selector in shop (product pages, category pages, cart)

In product page, a message appears to inform you that the product can only be purchased in minimum quantity.

Screenshots

  • Admin product page
  • Product page
Maximum quantity by group
Description

Force customers to purchase at most quantity of a product. Quantity can be set by group.

This setting is applied on each product quantity selector in shop (product pages, category pages, cart)

In product page, a message appears to inform you that the product can only be purchased in maximum quantity.

Screenshots

  • Admin product page
  • Product page

Product category options
Products > Categories > {Category}

Group access
Description

Manage product category visibility by group.

Screenshots

  • Admin product
    category page

Page options
Pages > All Pages > {Page}

Group access
Description

Manage page visibility by group. Not allowed pages will throw a 404 error.

Customization

You can customize redirect by using dedicated hooks:

Screenshots

  • Admin page

Coupon options
WooCommerce > Coupons > {Coupon}

Allowed groups
Description

Allow coupon usage to customers assigned to selected groups. No groups selected means no restrictions.

Screenshots

  • Admin coupons page

Import/Export tools
Products > All Products

Product Import/Export tools
Description

Bulk update B2B product informations. WooCommerce B2B extends default WooCommerce Import/Export tools to allow to fast manage its custom data.

Here a list of product fields managed by WooCommerce B2B you can bulk manage in Import/Export tools:

  • Groups increment quantity (packages)
  • Groups minimum quantity
  • Groups maximum quantity
  • Groups dedicated prices
  • Groups tier prices
  • Barcode

Tier group prices are formatted with a particular pattern. Each tier group price is identified by the couple quantity-price, separed by colon (:). Multiple tier group prices are separated by pipe (|). For example:

10:190|20:180

means that up to 10 quantity product price is 190, up to 20 quantity product price is 180 and so on.

You can add all tier group prices you prefer.

Note: to know more about WooCommerce Import/Export tools, please read Official documentation.
Screenshots

  • Admin products page
  • Import page

WordPress Export tools
Tools > Export

Customers export
Description

Allow to export customers list in CSV file to statistics purposes.

Screenshots

  • Admin export tools page
# Bundle options (*)
WooCommerce B2B special features to improve compatibility and sinergy with WooCommerce B2B Sales Agents
(*) Note: these options will appear only if WooCommerce B2B Sales Agents plugin is installed and active.

Customer page
Users > All Users > {User}

Sales agent customers default group
Description

Assign automatically customer to a B2B group when sales agent register a new customer account. Also available these special options:

  • Allow to choose: add a dropdown menu in registration forms, sales agents can choose group among those available

Screenshots

  • Admin user page

Group page
Users > All Groups > {Group}

Group commissions
Description

Assign a group commission to sales agent that will be apply on each purchase when customer belong the group.

Note: if product dedicated commission is set, it will override group commission on the product.
Screenshots

  • Admin group page
# Shortcodes
WooCommerce B2B introduces some shortodes, here a complete list with description to guide you in the configuration.

Latest purchases
Shortcode
[wcb2blatestpurchases]
Description

Shows a list of the latest products purchased by the user.

Parameters

limit: integer, to set the maximum number of products to show. Default: 10

days: integer, to limit the number of days to search for products. Default: 30

Screenshots

  • Example page
  • Shortcode usage

Group terms & conditions
Shortcode
[wcb2bgrouptermsconditions]
Description

It allow to have a dedicated Terms&Condition disclaimer to display to customers assigned to group.

In each group you can enter desired dedicated Terms&Conditions, the shortcode automatically check current customer group and display dedicated Terms&Condition.

Screenshots

  • Terms&Condition page
  • Shortcode usage

Quick order
Shortcode
[wcb2bquickorder]
Description

It allow to display the quick order form.

Screenshots

  • Quick order form
  • Shortcode usage

Live search
Shortcode
[wcb2blivesearch fixed=false]
Description

It allow to display the live search form.

Live search allow to instant get product by title or sku, with a quick add to cart button to have simpler and faster purchase process.

If you have products with variations, will be listed each single variation.

Note: depending on your needs, there may be a need to customize the style of the Live search form or the search results. You can do this by acting on the CSS through the dedicated classes assigned to each element, or by overriding the specific templates, as described in the Templates customization section.
Parameters

fixed: boolean (true/false) to apply absolute position to results container. Default: false

Customization

You can customize parameters by using dedicated hooks:

Screenshots

  • Live search form
  • Shortcode usage

Hidden prices
Shortcode
[wcb2bhiddenprices]
Description

It allow to display the hidden prices message to not logged in customers.

Screenshots

  • Product page
  • Shop page
  • Shortcode usage

Restricted contents
Shortcode
[wcb2brestrictedcontent]
Description

It allow to restrict some page contents only to certain groups.

Parameters

allowed: a comma separed list with groups ID you want to have access to the contents. This is a required parameter.

Screenshots

  • Example page
  • Shortcode usage

Login/Registration B2B forms
Shortcode
[wcb2bloginform wcb2b_group="136"]
Description

It allows you to create a dedicated login / registration forms for B2B users.

With the "wcb2b_group" parameter you spcify the group ID, so the customer registered through this form will be automatically assigned to the indicated group.

Parameters

wcb2b_group: integer value that contains the wanted group ID you want to assign customers registrated with this form. Default: false

You can retrieve the group ID directly from the backend URL on the edit group page. This is the number after "post=" or in "All groups" list page.
Below is a screenshot (in example images, ID is 136).

Customization

If you enabled "REGISTRATION FORMS" option to extend registration forms with billing fields, you can restrict extended fields only to these dedicated forms (not default my-account page) by using dedicated hook:

Screenshots

  • Group ID (in edit page)
  • Group ID (in list page)
  • Shortcode usage
# How to translate
Translate WooCommerce B2B is very simple.

WooCommerce B2B is already provided in two language: English and Italian.

All plugin strings have been localized using the GNU gettex framework to make it completely "translation ready", so it can be easly translated in the same way that other WordPress plugins.

Find out if WooCommerce B2B is available in your desired language, thanks to the collaboration of our fantastic users: Language packs.

This is a simple guide to translate WooCommerce B2B in the language of your choice.


Get a useful software: POEDIT

WordPress, with all its themes and plugins, based translations on GNU gettex framework, that use three types of files:

  • PO (Portable Object) files
  • MO (Machine Object) files
  • POT (Portable Object Template) files

The first step is to get a translation tool able to manage this kind of files; there are many ones available, but I suggest without doubt Poedit.

Poedit is a free open source software, easy to use and available for MacOSX, Windows, Linux and you can download it from here: https://poedit.net/download.


Translating with POEDIT

Create a new translation with Poedit is very simple, here a step-by-step guide to help you to make it.

  1. Install Poedit
  2. Open Poedit and go to:
    File -> New from POT/PO file
  3. In the popup box that appears, navigate into WooCommerce B2B folder and select the file:
    woocommerce-b2b/i18n/woocommerce-b2b.pot
  4. When the file is loaded, another box will pop up asking for the language you want to translate:
    Choose your language
  5. String by string, enter your translation in the Translate box at bottom.

When finished, validate your translation and save the file, named as: woocommerce-b2b-it_IT. The name pattern is composed by:

  • woocommerce-b2b: the plugin domain name, usually the plugin folder name (as described in WordPress i18n standards)
  • it: the GNU language code
  • IT: the GNU country code

Use your translation

After saving, Poedit will create two files:

  • woocommerce-b2b-it_IT.po
  • woocommerce-b2b-it_IT.mo

Your translations are ready! To use them, you just have to move them into the folder:

  • wp-content/languages/plugins/

Now, go to your website and WooCommerce B2B is finally translated in your language!


More informations

For more informations about language and country codes, please refer to:

For more informations about GNU gettex utilities and WordPress i18n, please refer to:

Note: if you want to contribute to WooCommerce B2B internationalization, please send your PO file to: support@woocommerce-b2b.com.
# Plugin Hooks
WooCommerce B2B provide large number of hooks to allow developers to extends or customize default behaviour.

If you are a developer, WooCommerce B2B give you many possible customizations by using the hooks. To know more about WordPress hooks working, please read Plugin API/Hooks WordPress Codex.

As WordPress best practice, we suggesto to make use of a WordPress Child Theme to avoid losing customizations in case of theme update. To know more about WordPress Child Theme, take a look to Child Themes WordPress Codex.

Here the list of WooCommerce B2B hooks:

Custom roles management
Description

WooCommerce B2B apply some own rules and functions only to default WooCommerce customer role. With this hook, you can extend these functions behaviour to custom roles.

Definition
apply_filters( 'wcb2b_has_role_customer', array $roles );
Defaults
$roles = array( 'customer' );
Example

To extend WooCommerce B2B functions to a new custom role called "mycustomrole", you can add this code to your functions.php file:

add_filter( 'wcb2b_has_role_customer', 'fn_wcb2b_has_role_customer' );
function fn_wcb2b_has_role_customer( $roles ) {
    $roles[] = 'mycustomrole';
    return $roles;
}
Redirect on resticted catalog page access
Description

Customize redirect when a customer try to access to a restricted page in your website.

Note: it requires "Restricted catalog" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_restricted_catalog_redirect', string $url );
Defaults
// My account page
$url = get_permalink( get_option( 'woocommerce_myaccount_page_id' ) );
Example

To change redirect to a custom page (with ID 123), you can add this code to your functions.php file:

add_filter( 'wcb2b_restricted_catalog_redirect', 'fn_wcb2b_restricted_catalog_redirect' );
function fn_wcb2b_restricted_catalog_redirect( $url ) {
    return get_the_permalink( 123 );
}
List of restricted pages
Description

Customize restricted access pages list.

Note: it requires "Restricted catalog" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_restricted_pages', array $pages );
Defaults
// WooCommerce pages
$pages = array(
    get_option( 'woocommerce_shop_page_id' ),
    get_option( 'woocommerce_cart_page_id' ),
    get_option( 'woocommerce_checkout_page_id' ),
    get_option( 'woocommerce_pay_page_id' ),
    get_option( 'woocommerce_thanks_page_id' ),
    get_option( 'woocommerce_edit_address_page_id' ),
    get_option( 'woocommerce_view_order_page_id' ),
    get_option( 'woocommerce_terms_page_id' )
);
Example

To remove a page from restricted list, you can add this code to your functions.php file:

add_filter( 'wcb2b_restricted_pages', 'fn_wcb2b_restricted_pages' );
function fn_wcb2b_restricted_pages( $pages ) {
    // Enable shop page
    add_filter( 'wcb2b_always_visible_pages', function( $pages ) {
    if (($key = array_search(get_option( 'woocommerce_shop_page_id' ), $pages)) !== false) {
            unset($pages[$key]);
        }
        return $pages;
    } );
    return $pages;
}

To add a page from restricted list, you can add this code to your functions.php file:

add_filter( 'wcb2b_restricted_pages', 'fn_wcb2b_restricted_pages' );
function fn_wcb2b_restricted_pages( $pages ) {
    // Restrict access to page with ID 99 
    $pages[] = 99;
    return $pages;
}
Always visible pages
Description

Customize the list of pages where you do not want the "Group visibility" option to appear so that they are always visible to all groups.

Note: it requires "Pages visibility" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_always_visible_pages', array $pages );
Defaults
// WooCommerce pages and homepage
$pages = array(
    get_option( 'woocommerce_shop_page_id' ),
    get_option( 'woocommerce_cart_page_id' ),
    get_option( 'woocommerce_checkout_page_id' ),
    get_option( 'woocommerce_pay_page_id' ),
    get_option( 'woocommerce_thanks_page_id' ),
    get_option( 'woocommerce_edit_address_page_id' ),
    get_option( 'woocommerce_view_order_page_id' ),
    get_option( 'woocommerce_terms_page_id' ),
    get_option( 'page_on_front' )
);
Example

To add a custom page to always visible page list, you can add this code to your functions.php file:

add_filter( 'wcb2b_always_visible_pages', 'fn_wcb2b_always_visible_pages' );
function fn_wcb2b_always_visible_pages( $pages ) {
    // Page with ID 99 will be always visibile to all groups
    $pages[] = 99;
    return $pages;
}
Always show all product variations
Description

Show by default all variation in variable products even if the variation is not available or salable, as happens with the hidden price. If you prefer, you can manage this behavior.

Definition
apply_filters( 'wcb2b_always_show_product_variation', bool $show, integer $variation_id, $product_id, $varation );
Defaults
$show = true;
Example

To restore default behavior, you can add this code to your functions.php file:

add_filter( 'wcb2b_always_show_product_variation', 'fn_wcb2b_always_show_product_variation' );
function fn_wcb2b_always_show_product_variation( $show, $variation_id, $product_id, $variation ) {
    return 'publish' === get_post_status( $variation->get_id() ) && '' !== $variation->get_price();
}

This hook works using default WooCommerce hook "woocommerce_variation_is_visible". To know more about "woocommerce_variation_is_visible" hook, please read: Hook reference.

Display login message on hidden prices
Description

Display message to invite to login instead of add-to-cart button, both in archive pages and product page.

Note: it requires "Hide prices" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_display_login_message', bool $display );
Defaults
$display = true;
Example

To remove login message, you can add this code to your functions.php file:

add_filter( 'wcb2b_display_login_message', 'fn_wcb2b_display_login_message' );
function fn_wcb2b_display_login_message( $display ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_display_login_message', '__return_false' );
Login message text on hidden prices
Description

Customize the login message text that replace add-to-cart buttons.

Note: it requires "Hide prices" option in WooCommerce B2B settings page is enabled and "wcb2b_display_login_message" hook filter is "true".
Definition
apply_filters( 'wcb2b_login_message', string $message );
Defaults
$message = __( 'Please, login to see prices and buy', 'woocommerce-b2b' );
Example

To change login message, you can add this code to your functions.php file:

add_filter( 'wcb2b_login_message', 'fn_wcb2b_login_message' );
function fn_wcb2b_login_message( $message ) {
    return __( 'Want to see prices? Please login!', 'woocommerce-b2b' );
}
Login message URL on hidden prices
Description

Customize the login message permalink that replace add-to-cart buttons.

Note: it requires "Hide prices" option in WooCommerce B2B settings page is enabled and "wcb2b_display_login_message" hook filter is "true".
Definition
apply_filters( 'wcb2b_login_message_url', string $url );
Defaults
// My account page
$url = get_permalink( get_option( 'woocommerce_myaccount_page_id' ) );
Example

To change login message permalink and redirect to a custom page (with ID 123), you can add this code to your functions.php file:

add_filter( 'wcb2b_login_message_url', 'fn_wcb2b_login_message_url' );
function fn_wcb2b_login_message_url( $url ) {
    return get_the_permalink( 123 );
}
Hidden pages by group redirect
Description

Enable redirect on hidden pages by group.

Definition
apply_filters( 'wcb2b_redirect_hidden_page', boolean $redirect );
Defaults
$redirect = false;
Example

To enable a redirect when a page visibility is hidden by customer group, you can add this code to your functions.php file:

add_filter( 'wcb2b_redirect_hidden_page', 'fn_wcb2b_redirect_hidden_page' );
function fn_wcb2b_redirect_hidden_page( $redirect ) {
    return 'your_desired_url';
}
Display barcode
Description

Enable/Disable product barcode displaying by condition.

Definition
apply_filters( 'wcb2b_show_barcode', boolean $display, integer $product_id );
Defaults
$display = true;
Example

To disable barcode visibility to guest customers, you can add this code to your functions.php file:

add_filter( 'wcb2b_show_barcode', 'fn_wcb2b_show_barcode', 10, 2 );
function fn_wcb2b_show_barcode( $display, $product_id ) {
    if ( ! is_user_logged_in() ) {
        $display = false;
    }
    return $display;
}
Display quantity messages on product page
Description

Display message to inform about product minimum quantity and minimum increment purchase in product page.

Definition
apply_filters( 'wcb2b_display_quantity_message', bool $display );
Defaults
$display = true;
Example

To remove quantity message, you can add this code to your functions.php file:

add_filter( 'wcb2b_display_quantity_message', 'fn_wcb2b_display_quantity_message' );
function fn_wcb2b_display_quantity_message( $display ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_display_quantity_message', '__return_false' );
Product minimum quantity message text
Description

Customize the minimum quantity message text exception. Displayed when only minimum quantity is set (no max).

Definition
apply_filters( 'wcb2b_minimum_message', string $message, int $quantity );
Defaults
// $quantity contain the minimum quantity set for product
$message = sprintf( __( 'You must purchase at least %s of this product', 'woocommerce-b2b' ), $quantity );
Example

To change minimum quantity message, you can add this code to your functions.php file:

add_filter( 'wcb2b_minimum_message', 'fn_wcb2b_minimum_message', 10, 2 );
function fn_wcb2b_minimum_message( $message, $quantity ) {
    return sprintf(
        __( 'To complete purchase, please add at least %s of this product', 'woocommerce-b2b' ),
        $quantity
    );
}
Product maximum quantity message text
Description

Customize the maximum quantity message text exception. Displayed when only maximum quantity is set (no min).

Definition
apply_filters( 'wcb2b_maximum_message', string $message, int $quantity );
Defaults
// $quantity contain the maximum quantity set for product
$message = sprintf( __( 'You can purchase at most %s of this product', 'woocommerce-b2b' ), $quantity );
Example

To change maximum quantity message, you can add this code to your functions.php file:

add_filter( 'wcb2b_maximum_message', 'fn_wcb2b_maximum_message', 10, 2 );
function fn_wcb2b_maximum_message( $message, $quantity ) {
    return sprintf(
        __( 'To complete purchase, please add at most %s of this product', 'woocommerce-b2b' ),
        $quantity
    );
}
Product minimum/maximum quantity message text
Description

Customize the minimum/maximum quantity message text exception. Displayed when both minimum and maximum quantity are set.

Definition
apply_filters( 'wcb2b_minmax_message', string $message, int $min_quantity, int max_quantity );
Defaults
// $min_quantity contain the minimum quantity set for product
// $max_quantity contain the maximum quantity set for product
$message = sprintf( __( 'You can purchase at least %s and at most %s of this product', 'woocommerce-b2b' ), $min_quantity, $max_quantity );
Example

To change minimum/maximum quantity message, you can add this code to your functions.php file:

add_filter( 'wcb2b_minmax_message', 'fn_wcb2b_minmax_message', 10, 2 );
function fn_wcb2b_minmax_message( $message, $min_quantity, $max_quantity ) {
    return sprintf(
        __( 'To complete purchase, please add at least %s and at most %s of this product', 'woocommerce-b2b' ),
        $min_quantity, $max_quantity
    );
}
Product increment quantity message text
Description

Customize the minimum increment quantity purchase message text exception.

Definition
apply_filters( 'wcb2b_increment_message', string $message, int $quantity );
Defaults
// $quantity contain the minimum increment quantity set for product
$message = sprintf( __( 'This product can be purchased by increments of %s', 'woocommerce-b2b' ), $quantity );
Example

To change minimum increment quantity message, you can add this code to your functions.php file:

add_filter( 'wcb2b_increment_message', 'fn_wcb2b_increment_message', 10, 2 );
function fn_wcb2b_increment_message( $message, $quantity ) {
    return sprintf(
        __( 'This product can be purchase by packaging of %s', 'woocommerce-b2b' ),
        $quantity
    );
}
Percentage discount message text
Description

Customize message displayed in customer account page or in product page to display discount amount assigned to customer.

Note: it requires "Show discount" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_discount_message', string $message, decimal $discount );
Defaults
// $discount contain the percentage discount set to group
$message = sprintf( __( 'Discount amount assigned to you: %s%%', 'woocommerce-b2b' ), $discount );
Example

To change discount message, you can add this code to your functions.php file:

add_filter( 'wcb2b_discount_message', 'fn_wcb2b_discount_message', 10, 2 );
function fn_wcb2b_discount_message( $message, $discount ) {
    return sprintf(
        __( 'Discount: %s', 'woocommerce-b2b' ),
        $discount
    );
}
Minimum cart amount message text
Description

Change the alert message displayed in cart and/or checkout page when the minimum cart amount isn't reached.

Note: it requires "Min purchase amount" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_display_min_purchase_cart_message', string $message, decimal $price_raw, string $price );
apply_filters( 'wcb2b_display_min_purchase_checkout_message', string $message, decimal $price_raw, string $price );
Defaults
// $price contain the minimum amount set in WooCommerce B2B settings to be able to purchase
$message = sprintf( __( 'To proceed to checkout and complete your purchase, make sure you have reached the minimum amount of %s.', 'woocommerce-b2b' ), $price );
// $price contain the minimum amount set in WooCommerce B2B settings to be able to purchase
$message = sprintf( __( 'To proceed to checkout and complete your purchase, you must reach the minimum amount of %s, but your total cart amount is currently %s. Return to %sshop%s', 'woocommerce-b2b' ), $min_price, wc_price( WC()->cart->cart_contents_total ), '', '' );
Example

To customize the alert message in cart page, you can add this code to your functions.php file:

add_filter( 'wcb2b_display_min_purchase_cart_message', 'fn_wcb2b_display_min_purchase_cart_message', 10, 3 );
function fn_wcb2b_display_min_purchase_cart_message( $message, $amount_raw, $amount ) {
    return sprintf(
        __( 'Sorry, you haven\'t reached the minimum amount to purchase (%s)', 'woocommerce-b2b' ),
        $amount
    );
}

To customize the alert message in chechout page:

add_filter( 'wcb2b_display_min_purchase_checkout_message', 'fn_wcb2b_display_min_purchase_checkout_message', 10, 3 );
function fn_wcb2b_display_min_purchase_checkout_message( $message, $amount_raw, $amount ) {
    return sprintf(
        __( 'Sorry, you haven\'t reached the minimum amount to purchase (%s)', 'woocommerce-b2b' ),
        $amount
    );
}

In both functions, $amount_raw is the numeric amount, while $amount is the formatted one with currency.

Send customer account activation email
Description

Send an email notification to customer when his account is activated.

Note: it requires "Moderate registration" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_send_activation_notification', bool $send );
Defaults
$send = true;
Example

To don't send any email notification to customer when his account his active, you can add this code to your functions.php file:

add_filter( 'wcb2b_send_activation_notification', 'fn_wcb2b_send_activation_notification' );
function fn_wcb2b_send_activation_notification( $send ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_send_activation_notification', '__return_false' );
Moderate account status only with VAT number
Description

By default, "Moderate registration" option impact an all customers. If you have an hybryd B2B/B2C shop and you want to restrict moderate registration to B2B customers, you can use this hook, that force moderate registration status check only if customer has a VAT number. Customer without a VAT number, are considered B2C and they don't needs to be activated. This hook fire when customer register.

Note: it requires "Moderate registration" option in WooCommerce B2B settings page is enabled. Note: it requires "Add VAT number field to billing address" option in WooCommerce B2B settings page is enabled. Note: it requires "Add billing data to registration forms" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_moderate_customer_registration_only_with_vat', bool $enable, integer $group_id );
Defaults
$enable = false;
Example

To restrict moderate registration check only to customers with VAT number when register, you can add this code to your functions.php file:

add_filter( 'wcb2b_moderate_customer_registration_only_with_vat', 'fn_wcb2b_moderate_customer_registration_only_with_vat', 10, 2 );
function fn_wcb2b_moderate_customer_registration_only_with_vat( $enable, $group_id ) {
    return true;
}

Or, alternatively:

add_filter( 'wcb2b_moderate_customer_registration_only_with_vat', '__return_true', 10, 2 );
Customer new account email B2B text
Description

Customize message displayed in new account email notification with B2B instructions.

Note: it requires "Moderate registration" option in WooCommerce B2B settings page is enabled and "wcb2b_send_activation_notification" hook filter is "true".
Definition
apply_filters( 'wcb2b_new_account_email', string $message );
Defaults
$message = __( 'We are checking your account, please wait for the activation confirmation email before trying to login', 'woocommerce-b2b' );
Example

To change message text in new account email, you can add this code to your functions.php file:

add_filter( 'wcb2b_new_account_email', 'fn_wcb2b_new_account_email' );
function fn_wcb2b_new_account_email( $message ) {
    return __( 'Your account is approving, we will send you a confirmation email and you can login', 'woocommerce-b2b' );
}
Remove customer data from admin new user notification email
Description

By default, admin new user notification email contains new customer billing address and group. You can remove them and leave only customer email and username by using this hook.

Note: it requires "Registration notice" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_extend_new_user_notification_email_admin', bool $enable );
Defaults
$enable = true;
Example

To prevent billing data and group in admin new user notification email, you can add this code to your functions.php file:

add_filter( 'wcb2b_extend_new_user_notification_email_admin', 'fn_wcb2b_extend_new_user_notification_email_admin' );
function fn_wcb2b_extend_new_user_notification_email_admin( $enable ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_extend_new_user_notification_email_admin', '__return_false' );
Wait for approval message in registration page
Description

Customize message displayed when an user register a new account and his account is waiting for moderation.

Note: it requires "Moderate registration" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_waiting_approvation', string $message );
Defaults
$message = __( 'Your account is now under review. You will receive an email as soon as it is activated.', 'woocommerce-b2b' );
Example

To change message text displayed when a customer register, you can add this code to your functions.php file:

add_filter( 'wcb2b_waiting_approvation', 'fn_wcb2b_waiting_approvation' );
function fn_wcb2b_waiting_approvation( $message ) {
    return __( 'Please wait for account activation email to login.', 'woocommerce-b2b' );
}
Unpaid orders arguments
Description

Customize the query that gets the customer's unpaid orders.

Definition
apply_filters( 'wcb2b_unpaid_orders_args', array $args, integer $customer_id );
Defaults
$args = array(
    'limit'        => -1,
    'customer_id'  => $customer_id,
    'type'         => 'shop_order',
    'status'       => array_keys( wc_get_is_pending_statuses() )
);
Example

To customize arguments list, you can add this code to your functions.php file:

add_filter( 'wcb2b_unpaid_orders_args', 'fn_wcb2b_unpaid_orders_args', 10, 2 );
function fn_wcb2b_unpaid_orders_args( $args, $customer_id ) {
    // Add 'on-hold' status among those to be considered unpaid
    $args['status'][] = 'my-custom-status';
    return $args;
}
Unpaid amount message text
Description

Customize message displayed in customer account page regarding unpaid total orders amount.

Definition
apply_filters( 'wcb2b_unpaid_message', string $message, integer $customer_id, decimal $unpaid_amount, decimal $unpaid_amount_limit );
Defaults
// $customer_id contains current customer ID
// $unpaid_amount contains customer total unpaid amount
// $unpaid_amount_limit contains customer total unpaid amount limit
$message = sprintf( __( 'Your unpaid amount: %s (Max allowed: %s)', 'woocommerce-b2b' ), $customer_id, $unpaid_amount, unpaid_amount_limit );
);
Example

To change unpaid total orders amount message, you can add this code to your functions.php file:

add_filter( 'wcb2b_unpaid_message', 'fn_wcb2b_unpaid_message', 10, 4 );
function fn_wcb2b_unpaid_message( $message, $customer_id, $unpaid_amount, unpaid_amount_limit ) {
    return sprintf( __( 'You have accumulated a total amount of unpaid orders of %s, while maximum allowed is %s', 'woocommerce-b2b' ), wc_price( $unpaid_amount ), wc_price( $unpaid_amount_limit ) );
}
Unpaid amount limit reached notice text
Description

Customize notice displayed in checkout if customer has reached and exceeded unpaid total orders amount limit.

Definition
apply_filters( 'wcb2b_unpaid_notice', string $notice, decimal $unpaid_amount_limit );
Defaults
// $unpaid_amount_limit contains customer total unpaid amount limit
$notice = sprintf( __( 'Sorry, you have reached unpaid total orders amount limit (%s)', 'woocommerce-b2b' ), wc_price( $unpaid_amount_limit ) );
);
Example

To change unpaid total orders amount limit reached notice, you can add this code to your functions.php file:

add_filter( 'wcb2b_unpaid_notice', 'fn_wcb2b_unpaid_notice', 10, 2 );
function fn_wcb2b_unpaid_notice( $notice, $unpaid_amount_limit ) {
    return sprintf( __( 'Total unpaid order amount limit (%s) has been reached', 'woocommerce-b2b' ), wc_price( $unpaid_amount_limit ) );
}
Show customer group
Description

Customize message displayed in customer account page to display discount group assigned to customer.

Note: it requires "Show customer group" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_show_group_message', string $message, string $group_name );
Defaults
$message = sprintf( __( 'Your group: %s', 'woocommerce-b2b' ), $group_name );
Example

To change group message, you can add this code to your functions.php file:

add_filter( 'wcb2b_show_group_message', 'fn_wcb2b_show_group_message', 10, 2 );
function fn_wcb2b_show_group_message( $message, $group_name ) {
    return sprintf(
        __( 'Here your current group: %s', 'woocommerce-b2b' ),
        $group_name
    );
}
Customer statuses
Description

Customize customer status to improve account moderation management.

Note: it requires "Moderate registration" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_customer_statuses', array $statuses );
Defaults
$statuses = array(
    0 => esc_html__( 'Inactive', 'woocommerce-b2b' ),
    1 => esc_html__( 'Active', 'woocommerce-b2b' )
);
Example

To add a custom status, you can add this code to your functions.php file:

add_filter( 'wcb2b_customer_statuses', 'fn_wcb2b_customer_statuses' );
function fn_wcb2b_customer_statuses( $statuses ) {
    $statuses[3] = esc_html__( 'Pending', 'woocommerce-b2b' );
    return $statuses;
}
Add billing fields only for B2B login/registration forms
Description

Extend registration forms with billing fields only for B2B login/registration page and not for default my-account page.

Note: it requires "Registration forms" option in WooCommerce B2B settings page is enabled.
Note: it use default WooCommerce template for login/registration (my-account/login-form.php). You can customize template by using the hook wcb2b_login_form_template.
Definition
apply_filters( 'wcb2b_extend_registration_form_b2b_only', boolean $only_b2b );
Defaults
$only_b2b = false;
Example

To apply billing fields only to dedicated B2B login/registration forms and remove from default my-account page, you can add this code to your functions.php file:

add_filter( 'wcb2b_extend_registration_form_b2b_only', 'fn_wcb2b_extend_registration_form_b2b_only' );
function fn_wcb2b_extend_registration_form_b2b_only( $b2b_only ) {
    return true;
}

Or, alternatively:

add_filter( 'wcb2b_extend_registration_form_b2b_only', '__return_true' );
B2B login/registration forms template
Description

Customize login/registration forms template used by shortcode [wcb2bloginform].

Definition
apply_filters( 'wcb2b_login_form_template', $template, $group_id );
Defaults
$template = 'myaccount/form-login.php';
Example

To change default template, you can add this code to your functions.php file:

add_filter( 'wcb2b_login_form_template', 'fn_wcb2b_login_form_template' );
function fn_wcb2b_login_form_template( $template, $group_id ) {
    // Change template only for login/registration form used for group with ID 100
    if ( 100 == $group_id ) {
        $template = 'your-custom-template-path.php';
    }
    return $template;
}
Customize registration forms fields
Description

Customize registration forms fields.

Note: it requires "Registration forms" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_register_form_fields', array $fields );
Example

To make company field not required in extended registration forms, you can add this code to your functions.php file:

add_filter( 'wcb2b_register_form_fields', 'fn_wcb2b_register_form_fields' );
function fn_wcb2b_register_form_fields( $fields ) {
    $fields['billing_company']['required'] = false;
    return $fields;
}

To remove phone field in extended registration forms, you can add this code to your functions.php file:

add_filter( 'wcb2b_register_form_fields', 'fn_wcb2b_register_form_fields' );
function fn_wcb2b_register_form_fields( $fields ) {
    unset( $fields['billing_phone'] );
    return $fields;
}

This hook works similarly to WooCommerce's default "woocommerce_billing_fields" hook, but only affects the registration forms. To know more about "woocommerce_billing_fields" hook, please read: Customizing checkout fields using actions and filters.

Customize VIES validation country list
Description

Customize countries considered in EU area for which the VIES validation is carried out.

Note: it requires "Enable VAT number VIES validation for EU customers" option in WooCommerce B2B settings page is enabled.
Definition
apply_filters( 'wcb2b_vies_countries', array $countries );
Example

To customize EU country list, you can add this code to your functions.php file:

add_filter( 'wcb2b_vies_countries', 'fn_wcb2b_vies_countries' );
function fn_wcb2b_vies_countries( $countries ) {
    // Remove Italy from country list
    unset( $countries['IT'] );
    return $countries;
}

Here the list of countries currently supported:

  • AT - Austria
  • BE - Belgium
  • BG - Bulgaria
  • CY - Cyprus
  • CZ - Czech Republic
  • DE - Germany
  • DK - Denmark
  • EE - Estonia
  • GR - Greece
  • ES - Spain
  • FI - Finland
  • FR - France
  • HR - Croatia
  • HU - Hungary
  • IE - Ireland
  • IT - Italy
  • LT - Lithuania
  • LU - Luxembourg
  • LV - Latvia
  • MT - Malta
  • NL - The Netherlands
  • PL - Poland
  • PT - Portugal
  • RO - Romania
  • SE - Sweden
  • SI - Slovenia
  • SK - Slovakia

To know more about supported EU member countries, please refer to: VIES VAT number validation.

To manage countries, you need to use their ISO codes (3166-1 alpha-2 version). To know more about ISO codes, please read: Two-letter country codes.


Since v2.1.6, WooCommerce B2B introduced transcoding capabilitites to prevent discrepancies between the country code provided by WooCommerce and the country code required by VIES. For example, for Greece, the country code used by WooCommerce is "GR", while the country code requested by VIES is "EL". The $countries parameter therefore has the format {WooCommerceCountryCode} => {ViesCountryCode} (ie: 'GR' => 'EL').

Customize Live Search AJAX parameters
Description

Customize Live Search AJAX parameters to pass to Javascript handler.

Definition
apply_filters( 'wcb2b_livesearch_params', array $params );
Defaults
$params = array(
    'current_url'        => get_the_permalink(),
    'ajax_url'           => WC()->ajax_url(),
    'wc_ajax_url'        => WC_AJAX::get_endpoint( '%%endpoint%%' ),
    'i18n_added_to_cart' => esc_attr__( 'Added to cart', 'woocommerce-b2b' ),
    'min_lenght'         => 3
);
Example

To customize parameters list, you can add this code to your functions.php file:

add_filter( 'wcb2b_livesearch_params', 'fn_wcb2b_livesearch_params' );
function fn_wcb2b_livesearch_params( $params ) {
    // Change string min lenght to start to search
    $params['min_lenght'] = 5;
    return $params;
}
Customize Live Search AJAX results
Description

Customize Live Search AJAX arguments to perform products query search.

Definition
apply_filters( 'wcb2b_livesearch_results_args', array $args );
Defaults
$args = array(
    'status'       => array( 'publish' ),
    'type'         => array( 'grouped', 'simple', 'variable' ),
    'limit'        => -1,
    'orderby'      => 'name',
    'order'        => 'ASC',
    'stock_status' => 'instock'
);
Example

To customize arguments list, you can add this code to your functions.php file:

add_filter( 'wcb2b_livesearch_results_args', 'fn_wcb2b_livesearch_results_args' );
function fn_wcb2b_livesearch_results_args( $args ) {
    // Remove grouped products from search results
    $args['type'] = array( 'simple', 'variable' );
    return $args;
}

To know more, please read: Code Reference.

Admin display order weight
Description

Display the order total weight in order details.

Definition
apply_filters( 'wcb2b_display_order_weight', bool $display );
Defaults
$display = true;
Example

To prevent weight to show in admin order details, you can add this code to your functions.php file:

add_filter( 'wcb2b_display_order_weight', 'fn_wcb2b_display_order_weight' );
function fn_wcb2b_display_order_weight( $display ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_display_order_weight', '__return_false' );
Admin display customer assigned group
Description

Display customer group in order details.

Definition
apply_filters( 'wcb2b_display_customer_group', bool $display );
Defaults
$display = true;
Example

To prevent customer group to show in admin order details, you can add this code to your functions.php file:

add_filter( 'wcb2b_display_customer_group', 'fn_wcb2b_display_customer_group' );
function fn_wcb2b_display_customer_group( $display ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_display_customer_group', '__return_false' );
Admin users filters dropdown
Description

Customize filters in users list page in admin.

Definition
apply_filters( 'wcb2b_users_extra_tablenav', string $filters );
Example

To add user filter, you can add this code to your functions.php file:

add_filter( 'wcb2b_users_extra_tablenav', 'fn_wcb2b_users_extra_tablenav' );
function fn_wcb2b_users_extra_tablenav( $filters ) {
    $filters += '<select name="custom" id="filter">
                    <option value="option1">Option 1</option>
                </select>';
    return $filters;
}

NB: remember to add your custom rules to filter users by using the default WordPress hook:

add_filter( 'pre_get_users', WP_User_Query $query );

To know more, please read: WordPress Code Reference.

Admin groups Terms&Conditions editor settings
Description

Customize editor settings in group page in Terms&Conditions box.

Definition
apply_filters( 'wcb2b_group_terms_conditions_editor', array $settings );
Defaults
$settings = array(
    'toolbar1'      => 'bold,italic,underline,separator,alignleft,aligncenter,alignright,separator,link,unlink,undo,redo',
    'toolbar2'      => '',
    'toolbar3'      => '',
);
Example

To remove the capability to add link, you can add this code to your functions.php file:

add_filter( 'wcb2b_group_terms_conditions_editor', 'fn_wcb2b_group_terms_conditions_editor' );
function fn_wcb2b_group_terms_conditions_editor( $settings ) {
    $settings['toolbar1'] = 'bold,italic,underline,separator,alignleft,aligncenter,alignright,separator,undo,redo';
    return $settings;
}

To know more, please read: WordPress Code Reference.

Settings extra fields
Description

Change, add or delete extra fields or WooCommerce B2B settings in admin.

Definition
apply_filters( 'wcb2b_general_settings', array $settings );
Example

To add your custom setting, you can add this code to your functions.php file:

add_filter( 'wcb2b_general_settings', 'fn_wcb2b_general_settings' );
function fn_wcb2b_general_settings( $settings ) {
    $settings += array(
        'section_title-wcb2b_custom_section' => array(
            'name'     => __( 'Custom option section title', 'woocommerce-b2b' ),
            'type'     => 'title',
            'desc'     => __( 'Custom option section description', 'woocommerce-b2b' )
        ),
        'option-wcb2b_custom' => array(
            'name' => __( 'Custom option', 'woocommerce-b2b' ),
            'type' => 'text',
            'desc' => __( 'Custom option description', 'woocommerce-b2b' ),
            'id'   => 'custom'
        ),
        'section_end-wcb2b_custom_section' => array(
             'type' => 'sectionend'
        )
    );
    return $settings;
}
WooCommerce B2B generator tag
Description

Output generator tag in website head to aid debugging.

Definition
apply_filters( 'wcb2b_show_generator_tag', boolean $show );
Defaults
$show = true;
Example

To remove generator tag, you can add this code to your functions.php file:

add_filter( 'wcb2b_show_generator_tag', 'fn_wcb2b_show_generator_tag' );
function fn_wcb2b_show_generator_tag( $show ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_show_generator_tag', '__return_false' );
WooCommerce B2B before init
Description

Triggered when WordPress initialises.

Definition
do_action( 'wcb2b_before_init' );
Example

To add a new callback, you can add this code to your functions.php file:

add_action( 'wcb2b_before_init', 'fn_wcb2b_before_init' );
function fn_wcb2b_before_init() {
    // Make action magic happen here...
}
WooCommerce B2B init
Description

Triggered after plugin has initialized.

Definition
do_action( 'wcb2b_init' );
Example

To add a new callback, you can add this code to your functions.php file:

add_action( 'wcb2b_init', 'fn_wcb2b_init' );
function fn_wcb2b_init() {
    // Make action magic happen here...
}
WooCommerce B2B loaded
Description

Triggered when plugin has loaded.

Definition
do_action( 'wcb2b_loaded' );
Example

To add a new callback, you can add this code to your functions.php file:

add_action( 'wcb2b_iwcb2b_loadednit', 'fn_wcb2b_loaded' );
function fn_wcb2b_loaded() {
    // Make action magic happen here...
}
# REST API support
Manage WooCommerce B2B data with extended REST API.

Groups API
Description

This API lets you retrieve and view all groups or a specific group by ID.

WooCommerce B2B available meta fields:

  • wcb2b_group_discount: contains global percentage discount assigned to group
    Value is a floating number
    In API GET response, has also a dedicated field alias named "wcb2b_group_discount_percentage"
  • wcb2b_group_min_purchase_amount: contains minimum purchase amount to purchase
    Value is a floating number
    In API GET response, has also a dedicated field alias named "wcb2b_group_min_purchase_amount"
  • wcb2b_group_packaging_fee: contains packaging fee.
    Value is an associative array with:
    • type: type of fee. Can be "amount" or "percent"
    • value: fee to apply. It's a floating number

    In API GET response, has also a dedicated field alias named "wcb2b_group_packaging_fee"
  • wcb2b_group_terms_conditions: contains dedicated Terms and Conditions text
    Value is a text (can include HTML)
    In API GET response, has also a dedicated field alias named "wcb2b_group_terms_conditions"
  • wcb2b_group_shippings: contains shipping methods disabled
    Value is a simple array with all shipping methods slugs to disable
    In API GET response, has also a dedicated field alias named "wcb2b_group_disabled_shippings"
  • wcb2b_group_gateways: contains payment methods disabled
    Value is a simple array with all payment methods slugs to disable
    In API GET response, has also a dedicated field alias named "wcb2b_group_disabled_gateways"

Note: WooCommerce B2B extends default WordPress posts REST API with own custom meta fields. For more informations, please visit: WordPress Official documentation


HTTP request (all groups)
get
/wp-json/wc/v3/groups

Available parameters
int|string $author Author ID, or comma-separated list of IDs
string $author_name User 'user_nicename'
array $author__in An array of author IDs to query from
array $author__not_in An array of author IDs not to query from
array $date_query An associative array of WP_Date_Query arguments. See WP_Date_Query::__construct()
bool $exact Whether to search by exact keyword. Default false
array $meta_query An associative array of WP_Meta_Query arguments. See WP_Meta_Query
int $menu_order The menu order of the posts
string $name Post slug
bool $nopaging Show all posts (true) or paginate (false). Default false
bool $no_found_rows Whether to skip counting the total rows found. Enabling can improve performance. Default false
int $offset The number of posts to offset before retrieval
string $order Designates ascending or descending order of posts. Default 'DESC'. Accepts 'ASC', 'DESC'
string|array $orderby Sort retrieved posts by parameter
int $page Show the number of posts that would show up on page X of a static front page
int $paged The number of the current page
string $pagename Page slug
string $perm Show posts if user has the appropriate capability
array $post__in An array of post IDs to retrieve, sticky posts will be included
array $post__not_in An array of post IDs not to retrieve. Note: a string of comma-separated IDs will NOT work
string|array $post_status A post status (string) or array of post statuses
int $posts_per_page The number of posts to query for. Use -1 to request all posts
array $post_name__in An array of post slugs that results must match
string $s Search keyword(s). Prepending a term with a hyphen will exclude posts matching that term
string $title Post title

Note: This parameters are WordPress WP_Query defaults. For more informations, please visit: WordPress Official documentation


HTTP request (single group)
get
/wp-json/wc/v3/groups/{ID}

Example response
{
    "ID": 273,
    "post_author": "1",
    "post_date": "2020-06-13 00:00:00",
    "post_date_gmt": "2020-06-13 00:00:00",
    "post_content": "",
    "post_title": "Partners",
    "post_excerpt": "",
    "post_status": "publish",
    "comment_status": "closed",
    "ping_status": "closed",
    "post_password": "",
    "post_name": "partners",
    "to_ping": "",
    "pinged": "",
    "post_modified": "2020-06-13 00:00:00",
    "post_modified_gmt": "2020-06-13 00:00:00",
    "post_content_filtered": "",
    "post_parent": 0,
    "guid": "https://demo.woocommerce-b2b.com/wcb2b_group/partners/",
    "menu_order": 0,
    "post_type": "wcb2b_group",
    "post_mime_type": "",
    "comment_count": "0",
    "filter": "raw",
    "wcb2b_group_discount_percentage": "10",
    "wcb2b_group_min_purchase_amount": "500",
    "wcb2b_group_packaging_fee": {
        "type": "percent",
        "value": "3"
    },
    "wcb2b_group_terms_conditions": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
    "wcb2b_group_disabled_shippings": [
        "flat_rate"
    ],
    "wcb2b_group_disabled_gateways": [
        "bacs",
        "cheque"
    ]
}
HTTP request (create group)
post
/wp-json/wc/v3/groups/

Example data
{"name": "Partners", wcb2b_group_discount":15}
                                    

HTTP request (update group)
put
/wp-json/wc/v3/groups/{ID}

Example data
{"wcb2b_group_discount":15}
                                    

HTTP request (delete group)
delete
/wp-json/wc/v3/groups/{ID}
Product API
Description

This API lets you retrieve and view all products or a specific product by ID.

WooCommerce B2B available meta fields:

  • wcb2b_product_group_prices: contains dedicated prices by group.
    Value is a multidimensional array with GROUP ID as key and associative subarray:
    • regular_price: dedicated group regular price. It's a floating number
    • sale_price: dedicated group sale price. It's a floating number

    In API GET response, has also a dedicated field alias named "wcb2b_group_prices"
  • wcb2b_product_group_tier_prices: contains tiered prices by group.
    Value is a multidimensional array with GROUP ID as key and associative subarray:
    • {QUANTITY}: minimum quantity to apply tier price. It's an integer number
    • {PRICE}: tier price. It's a floating number

    In API GET response, has also a dedicated field alias named "wcb2b_group_tier_prices"
  • wcb2b_product_group_packages: contains package increment quantity.
    Value is an array with GROUP ID as key and integer package as value.
    In API GET response, has also a dedicated field alias named "wcb2b_packages_quantity"
  • wcb2b_product_group_min: contains minimum quantity allowed.
    Value is an array with GROUP ID as key and integer quantity value.
    In API GET response, has also a dedicated field alias named "wcb2b_min_quantity"
  • wcb2b_product_group_max: contains maximum quantity allowed.
    Value is an array with GROUP ID as key and integer quantity value.
    In API GET response, has also a dedicated field alias named "wcb2b_max_quantity"
  • wcb2b_barcode: contains product barcode.
    Value is a string
    In API GET response, has also a dedicated field alias named "wcb2b_barcode"
  • wcb2b_product_group_hide_prices: contains groups with hidden prices.
    Value is an array with GROUP IDs
    In API GET response, has also a dedicated field alias named "wcb2b_group_hide_prices"
  • wcb2b_product_group_hide_stocks: contains groups with hidden stocks.
    Value is an array with GROUP IDs
    In API GET response, has also a dedicated field alias named "wcb2b_group_hide_stocks"

Note: WooCommerce B2B extends default WooCommerce products REST API with own custom meta fields. For more informations, please visit: WooCommerce Official documentation


HTTP request (all products)
get
/wp-json/wc/v3/products

HTTP request (single product)
get
/wp-json/wc/v3/products/{ID}

Example response
{
    "id": 60,
    "name": "T-Shirt with Logo",
    "slug": "t-shirt-with-logo",
    "permalink": "https://demo.woocommerce-b2b.com/product/t-shirt-with-logo/",
    "date_created": "2020-06-13 00:00:00",
    "date_created_gmt": "2020-06-13 00:00:00",
    "date_modified": "2020-06-13 00:00:00",
    "date_modified_gmt": "2020-06-13 00:00:00",
    "type": "simple",
    "status": "publish",
    "featured": false,
    "catalog_visibility": "visible",
    "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
    "short_description": "<p>This is a simple product.</p>\n",
    "sku": "Woo-tshirt-logo",
    "price": "98",
    "regular_price": "100",
    "sale_price": "98",
    "date_on_sale_from": null,
    "date_on_sale_from_gmt": null,
    "date_on_sale_to": null,
    "date_on_sale_to_gmt": null,
    "price_html": "<del><span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>100.00</span></del> <ins><span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>98.00</span></ins>",
    "on_sale": true,
    "purchasable": true,
    "total_sales": 0,
    "virtual": false,
    "downloadable": false,
    "downloads": [],
    "download_limit": 0,
    "download_expiry": 0,
    "external_url": "",
    "button_text": "",
    "tax_status": "taxable",
    "tax_class": "",
    "manage_stock": false,
    "stock_quantity": null,
    "stock_status": "instock",
    "backorders": "no",
    "backorders_allowed": false,
    "backordered": false,
    "sold_individually": false,
    "weight": "",
    "dimensions": {
        "length": "10",
        "width": "12",
        "height": "0.5"
    },
    "shipping_required": true,
    "shipping_taxable": true,
    "shipping_class": "",
    "shipping_class_id": 0,
    "reviews_allowed": true,
    "average_rating": "0.00",
    "rating_count": 0,
    "related_ids": [
        50,
        40,
        43,
        51
    ],
    "upsell_ids": [],
    "cross_sell_ids": [],
    "parent_id": 0,
    "purchase_note": "",
    "categories": [
        {
            "id": 20,
            "name": "Tshirts",
            "slug": "tshirts-clothing"
        }
    ],
    "tags": [],
    "images": [
        {
            "id": 83,
            "date_created": "2020-06-13 00:00:00",
            "date_created_gmt": "2020-06-13 00:00:00",
            "date_modified": "2020-06-13 00:00:00",
            "date_modified_gmt": "2020-06-13 00:00:00",
            "src": "https://demo.woocommerce-b2b.com/wp-content/uploads/2020/06/t-shirt-with-logo-1.jpg",
            "name": "t-shirt-with-logo-1.jpg",
            "alt": ""
        }
    ],
    "attributes": [
        {
            "id": 1,
            "name": "Color",
            "position": 0,
            "visible": true,
            "variation": false,
            "options": [
            "Gray"
            ]
        }
    ],
    "default_attributes": [],
    "variations": [],
    "grouped_products": [],
    "menu_order": 0,
    "meta_data": [
        {
            "id": 967,
            "key": "_wpcom_is_markdown",
            "value": "1"
        },
        {
            "id": 3150,
            "key": "wcb2b_barcode",
            "value": "0123456789"
        },
        {
            "id": 3151,
            "key": "wcb2b_product_group_packages",
            "value": {
                "274" : "10",
                "275" : "10",
                "276" : "10",
                "277" : "10",
                "278" : "10"
            }
        },
        {
            "id": 3152,
            "key": "wcb2b_product_group_min",
            "value": {
                "274" : "20",
                "275" : "20",
                "276" : "20",
                "277" : "20",
                "278" : "20"
            }
        },
        {
            "id": 3153,
            "key": "wcb2b_product_group_max",
            "value": {
                "274" : "200",
                "275" : "200",
                "276" : "200",
                "277" : "200",
                "278" : "200"
            }
        },
        {
            "id": 245144,
            "key": "wcb2b_product_group_hide_prices",
            "value": [
                275
            ]
        },
        {
            "id": 245145,
            "key": "wcb2b_product_group_hide_stocks",
            "value": [
                275
            ]
        },
        {
            "id": 3154,
            "key": "wcb2b_product_group_prices",
            "value": {
                "274": {
                    "regular_price": "",
                    "sale_price": ""
                },
                "275": {
                    "regular_price": "",
                    "sale_price": ""
                },
                "276": {
                    "regular_price": "95.00",
                    "sale_price": ""
                },
                "277": {
                    "regular_price": "98.00",
                    "sale_price": ""
                },
                "278": {
                    "regular_price": "80.00",
                    "sale_price": "78.00"
                }
            }
        },
        {
            "id": 3155,
            "key": "wcb2b_product_group_tier_prices",
            "value": {
                "275": {
                    "100": "50.00"
                },
                "278": {
                    "5": "75.00",
                    "10": "74.00",
                    "20": "70.00"
                }
            }
        }
    ],
    "wcb2b_group_hide_prices": [
        [
          275
        ]
    ],
    "wcb2b_group_tier_prices": [
        {
            "275": {
                "100": "50.00"
            },
            "278": {
                "5": "75.00",
                "10": "74.00",
                "20": "70.00"
            }
        }
    ],
    "wcb2b_group_prices": [
        {
            "274": {
                "regular_price": "",
                "sale_price": ""
            },
            "275": {
                "regular_price": "",
                "sale_price": ""
            },
            "276": {
                "regular_price": "95.00",
                "sale_price": ""
            },
            "277": {
                "regular_price": "98.00",
                "sale_price": ""
            },
            "278": {
                "regular_price": "80.00",
                "sale_price": "78.00"
            }
        }
    ],
    "wcb2b_barcode": [
        "0123456789"
    ],
    "wcb2b_package_quantity": {
        "274" : "10",
        "275" : "10",
        "276" : "10",
        "277" : "10",
        "278" : "10"
    },
    "wcb2b_max_quantity": {
        "274" : "200",
        "275" : "200",
        "276" : "200",
        "277" : "200",
        "278" : "200"
    },
    "wcb2b_min_quantity": {
        "274" : "20",
        "275" : "20",
        "276" : "20",
        "277" : "20",
        "278" : "20"
    },
    "_links": {
        "self": [
            {
                "href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/products/60"
            }
        ],
        "collection": [
            {
                "href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/products"
            }
        ]
    }
}
Customer API
Description

This API lets you retrieve and view all customers or a specific customer by ID.

WooCommerce B2B available meta fields:

  • wcb2b_group: contains customer assigned Group ID.
    Value is an integer number
    In API GET response, has also a dedicated field alias named "wcb2b_group"
  • wcb2b_status: contains customer status (if moderate registration is enabled).
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_status"
  • wcb2b_unpaid_limit: contains customer unpaid orders total amout.
    Value is an integer number
    In API GET response, has also a dedicated field alias named "wcb2b_unpaid_limit"
  • billing_vat: contains customer VAT number.
    Value is a string
    In API GET response, has also a dedicated field alias named "wcb2b_vat_number"
    In API GET response, it's also available in billing address data
  • billing_invoice_email: contains customer dedicated invoice email address.
    Value is a string
    In API GET response, has also a dedicated field alias named "wcb2b_invoice_email"
    In API GET response, it's also available in billing address data

Note: WooCommerce B2B extends default WooCommerce customers REST API with own custom meta fields. For more informations, please visit: WooCommerce Official documentation


HTTP request (all customers)
get
/wp-json/wc/v3/customers

HTTP request (single customer)
get
/wp-json/wc/v3/customers/{ID}

Example response
{
    "id": 2,
    "date_created": "2020-06-13T00:00:0",
    "date_created_gmt": "2020-06-13T00:0:0",
    "date_modified": "2020-06-13T00:00:00",
    "date_modified_gmt": "2020-06-13T00:00:00",
    "email": "customer@woocommerce-b2b.com",
    "first_name": "John",
    "last_name": "Doe",
    "role": "customer",
    "username": "customer",
    "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "Google LLC",
        "address_1": "Central Park, 1",
        "address_2": "",
        "city": "New York",
        "postcode": "10001",
        "country": "US",
        "state": "NY",
        "email": "customer@woocommerce-b2b.com",
        "phone": "212-223-6457",
        "vat_number": "0987654321",
        "invoice_email": "invoices@woocommerce-b2b.com"
    },
    "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "Google LLC",
        "address_1": "Central Park, 1",
        "address_2": "",
        "city": "New York",
        "postcode": "10001",
        "country": "US",
        "state": "NY"
    },
    "is_paying_customer": true,
    "avatar_url": "https://secure.gravatar.com/avatar/25c626881bff6847aa6efc0820f01ec5?s=96&d=mm&r=g",
    "meta_data": [
        {
            "id": 62,
            "key": "wc_last_active",
            "value": "1592092800"
        },
        {
        "id": 353,
            "key": "shipping_method",
            "value": [
                "flat_rate:2"
            ]
        },
        {
            "id": 830,
            "key": "wcb2b_group",
            "value": "277"
        },
        {
            "id": 848,
            "key": "wcb2b_status",
            "value": "1"
        },
        {
            "id": 852,
            "key": "wcb2b_unpaid_limit",
            "value": "1000"
        },
        {
            "id": 850,
            "key": "billing_vat",
            "value": "0987654321"
        },
        {
            "id": 851,
            "key": "invoice_email",
            "value": "invoices@woocommerce-b2b.com"
        }
    ],
    "wcb2b_invoice_email": "invoices@woocommerce-b2b.com",
    "wcb2b_vat_number": "0987654321",
    "wcb2b_unpaid_limit": "1000",
    "wcb2b_status": 1,
    "wcb2b_group": {
        "id": 277,
        "name": "Partners",
        "discount": "15"
    },
    "_links": {
        "self": [
            {
                "href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/customers/2"
            }
        ],
        "collection": [
            {
                "href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/customers"
            }
        ]
    }
}
Order API
Description

This API lets you retrieve and view all orders or a specific order by ID.

WooCommerce B2B available meta fields:

  • _wcb2b_external_invoice_number: contains associated external invoice number.
    Value is text
    In API GET response, has also a dedicated field alias named "wcb2b_external_invoice_number"
  • _wcb2b_group: contains customer assigned group when order placed.
    Value is an integer number
    In API GET response, has also a dedicated field alias named "wcb2b_group"
  • _total_weight: contains cart products total weight when order placed.
    Value is a floating number
    In API GET response, has also a dedicated field alias named "wcb2b_total_weight"

Note: WooCommerce B2B extends default WooCommerce products REST API with own custom meta fields. For more informations, please visit: WooCommerce Official documentation


HTTP request (all orders)
get
/wp-json/wc/v3/orders

HTTP request (single order)
get
/wp-json/wc/v3/orders/{ID}

Example response
{
    "id": 101,
    "parent_id": 0,
    "number": "101",
    "order_key": "wc_order_AZ59JpOFpEQcv",
    "created_via": "checkout",
    "version": "4.3.0",
    "status": "completed",
    "currency": "USD",
    "date_created": "2020-06-13T02:00:0",
    "date_created_gmt": "2020-06-13T00:00:0",
    "date_modified": "2020-06-13T02:00:0",
    "date_modified_gmt": "2020-06-13T00:00:0",
    "discount_total": "0.00",
    "discount_tax": "0.00",
    "shipping_total": "20.00",
    "shipping_tax": "4.40",
    "cart_tax": "51.12",
    "total": "307.90",
    "total_tax": "55.52",
    "prices_include_tax": true,
    "customer_id": 2,
    "customer_ip_address": "***",
    "customer_user_agent": "***",
    "customer_note": "",
    "billing": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "Google LLC",
        "address_1": "Central Park, 1",
        "address_2": "",
        "city": "New York",
        "state": "NY",
        "postcode": "10001",
        "country": "US",
        "email": "customer@woocommerce-b2b.com",
        "phone": "2122236457"
    },
    "shipping": {
        "first_name": "John",
        "last_name": "Doe",
        "company": "Google LLC",
        "address_1": "Central Park, 1",
        "address_2": "",
        "city": "New York",
        "state": "NY",
        "postcode": "10001",
        "country": "US"
    },
    "payment_method": "bacs",
    "payment_method_title": "Direct bank transfer",
    "transaction_id": "",
    "date_paid": "2020-06-13T02:00:0",
    "date_paid_gmt": "2020-06-13T00:00:0",
    "date_completed": "2020-06-13T02:00:0",
    "date_completed_gmt": "2020-06-13T00:00:0",
    "cart_hash": "4c4d2a2498f758a949a05f83a439b8e5",
    "meta_data": [
        {
            "id": 5360,
            "key": "_billing_vat",
            "value": "1234567890"
        },
        {
            "id": 5361,
            "key": "is_vat_exempt",
            "value": "no"
        },
        {
            "id": 5362,
            "key": "_wcb2b_external_invoice_number",
            "value": "FA-12345"
        },
        {
            "id": 5363,
            "key": "_total_weight",
            "value": "2"
        },
        {
            "id": 5364,
            "key": "_wcb2b_group",
            "value": "74"
        },
        {
            "id": 5365,
            "key": "_billing_invoice_email",
            "value": "invoices@woocommerce-b2b.com"
        }
    ],
    "line_items": [
        {
            "id": 9,
            "name": "Hoodie - Blue, Yes",
            "product_id": 12,
            "variation_id": 35,
            "quantity": 7,
            "tax_class": "",
            "subtotal": "232.38",
            "subtotal_tax": "51.12",
            "total": "232.38",
            "total_tax": "51.12",
            "taxes": [
                {
                    "id": 1,
                    "total": "51.12",
                    "subtotal": "51.12"
                }
            ],
            "meta_data": [
                {
                    "id": 82,
                    "key": "pa_color",
                    "value": "blue",
                    "display_key": "Color",
                    "display_value": "Blue"
                },
                {
                    "id": 83,
                    "key": "logo",
                    "value": "Yes",
                    "display_key": "Logo",
                    "display_value": "Yes"
                }
            ],
            "sku": "woo-hoodie-blue-logo",
            "price": 33.19672128571428,
            "parent_name": "Hoodie"
        }
    ],
    "tax_lines": [
        {
            "id": 11,
            "rate_code": "TAX-1",
            "rate_id": 1,
            "label": "Tax",
            "compound": false,
            "tax_total": "51.12",
            "shipping_tax_total": "4.40",
            "rate_percent": 22,
            "meta_data": []
        }
    ],
    "shipping_lines": [
        {
            "id": 10,
            "method_title": "Flat rate",
            "method_id": "flat_rate",
            "instance_id": "2",
            "total": "20.00",
            "total_tax": "4.40",
            "taxes": [
                {
                    "id": 1,
                    "total": "4.4",
                    "subtotal": ""
                }
            ],
            "meta_data": [
                {
                    "id": 90,
                    "key": "Products",
                    "value": "Hoodie - Blue, Yes × 7",
                    "display_key": "Products",
                    "display_value": "Hoodie - Blue, Yes × 7"
                }
            ]
        }
    ],
    "fee_lines": [],
    "coupon_lines": [],
    "refunds": [],
    "currency_symbol": "$",
    "wcb2b_external_invoice_number": "invoices@woocommerce-b2b.com",
    "wcb2b_group": 74,
    "wcb2b_total_weight": 2,
    "_links": {
        "self": [
            {
                "href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/orders/101"
            }
        ],
        "collection": [
            {
                "href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/orders"
            }
        ],
        "customer": [
            {
                "href": "https://demo.woocommerce-b2b.com/wp-json/wc/v3/customers/2"
            }
        ]
    }
}

For more informations about REST API, please take a look to WooCommerce Official documentation.

# Templates customization
WooCommerce B2B templates can be override to customize as you prefer.

Templates override

WooCommerce B2B make use of same WooCommerce override system, so it's possible to create own templates and customize them.

Here a list of WooCommerce B2B templates that can be customized:

  • templates/order/quick-order-form.php: display form to upload quick order CSV files.
  • templates/single-product/barcode.php: display barcode in single page product.
  • templates/single-product/rrp-price.php: display recommended retail price in single page product.
  • templates/single-product/tier-price.php: display list of tier group prices in single page product.
  • templates/single-product/already-bought.php: show if product has already been purchased by current logged in customer.
  • templates/single-product/sales.php: show the total number of product sales on the product detail page.
  • templates/single-product/tabs/shippings.php: shows additional tab with shippings summary table on product detail page.
  • templates/email/customer-onquote-order.php: email received from customers when a new quote is created.
  • templates/email/customer-quoted-order.php: email received from customers when a quote is modified and set on "Quoted" status.
  • templates/email/customer-status-notification.php: email received from customers when his account is active.
  • templates/email/new-quote.php: email received from admin when a new quote is created.
  • templates/global/live-search-form.php: products live search form.
  • templates/global/live-search-form-product.php: live search form single products result.
How to override a template
  1. Copy the default template from:
    wp-content/plugins/woocommerce-b2b/templates/{TEMPLATE_PATH}
    and paste it in your theme folder at:
    wp-content/themes/{YOUR_ACTIVE_THEME}/woocommerce-b2b/
    preserving the same folder tree.
  2. Open the template you pasted into the theme folder with a text editor of choice and perform any changes that you want in your new template file.

To know more about this kind of system, take a look to Template structure & Overriding templates via a theme.

How to update templates overrides

Sometimes we update default templates when a new version of WooCommerce B2B is released. If you are using older templates, you may need to update them.

  1. Go to: WooCommerce > Settings > B2B > Status. Here there is a list of templates overridden by your parent/child theme and a warning message that they need to be updated.

    • Status tab
  2. Save a backup of the outdated template.
  3. Copy the default template from:
    wp-content/plugins/woocommerce-b2b/templates/{TEMPLATE_PATH}
    and paste it in your theme folder at:
    wp-content/themes/{YOUR_ACTIVE_THEME}/woocommerce-b2b/
    preserving the same folder tree.
  4. Open the template you pasted into the theme folder with a text editor of choice and replicate any changes that you had to the previous template in your new, updated template file.
# Pluggable functions
WooCommerce B2B provide large number of pluggable functions to allow developers to extends or customize default behavior.

If you are a developer, WooCommerce B2B give you many possible customizations by using the pluggable functions. To know more about WordPress pluggable functions working, please read Pluggable Functions WordPress Codex.

As WordPress best practice, we suggesto to make use of a WordPress Child Theme to avoid losing customizations in case of theme update. To know more about WordPress Child Theme, take alook to Child Themes WordPress Codex.

All WooCommerce B2B pluggable functions are contained into the file:

  • wp-content/plugins/woocommerce-b2b/includes/wcb2b-functions.php
# Compatibility
Take a look to most common compatibility adjusts about WooCommerce B2B with other plugins or themes.

WooCommerce B2B make use of standard WooCommerce hooks and best practice to warranty a great compatibility with themes or third part plugins.

However, in some cases, there may be minor incompatibilities that need minor adjustments.

As WordPress best practice, we suggesto to make use of a WordPress Child Theme to avoid losing customizations in case of theme update. To know more about WordPress Child Theme, take alook to Child Themes WordPress Codex.

Here are the known ones.


WPML plugin
Description

When the “PAGE VISIBILITY” option is enabled, translated pages could give you a 404 error.

Solution

To resolve, it is sufficient to set "wcb2b_group_visibility" meta as a copy for the translated pages.


# Frequently Asked Questions
Take a look to users most common questions and learn more about WooCommerce B2B.

Take advantage of other users experience, by reading our FAQs

# Changelog
What's new in latest WooCommerce B2B version?

Here all the versions of WooCommerce B2B: Changelog

# Support
Need help with WooCommerce B2B and you cannot find the solution in documentation?

Thanks for purchasing WooCommerce B2B plugin for WordPress/WooCommerce, proudly developed by @code4life, visit the author website.

If you have any kind of question or doubt, please visit new WooCommerce B2B Support Center, we'll do our best to assist you.

WooCommerce B2B support team