WooCommerce B2B

Current version: 4.0.2



# 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
# Installation
There are multiple ways to install WooCommerce B2B, here is a quick step-by-step guide to do this.

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
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

Update

You can update WooCommerce B2B in several ways:

  • Classic WordPress mode: follow all steps described in previous paragraph relative to "Installation". After upload, please follow screen instuctions.
  • Manual mode: follow all steps described in previous paragraph relative to "Installation" and replace previous WooCommerce B2B plugin folder.
  • Envato Market mode: please look for third part plugin "Envato Market", download, install and configure it as described in its own page.

More informations in our FAQ "How do I update the plugin?".

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.


Note: Actions are added to the WordPress scheduler and run on a scheduled basis, depending on your cron settings, if any, so they may take some time to fully run. It is possible to force execution by clicking on the "Run" link next to each action.
# 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.
# Troubles and malfunctions
In case of malfunctions it is advisable to check the real cause of the problem.

How to debug in right way

Often any malfunctions or problems appear to be caused by a plugin, but in reality the source of the problem is another interfering plugin.

It is very important to understand the source of a malfunction in order to direct support requests to the right team, avoiding delays and frustration.

WordPress debug mode

First of all, please be sure to enable WordPress debug mode, to have a log with detailed errors, as described in WordPress official documentation

Take a look to debug.log file in wp-content folder to discover the file that caused the issue.

WordPress best practice

When you have several plugins and you don't know the precise cause of a problem, WordPress best practices suggest an effective method to limit the cause of a possible problem, which consists in disabling all plugins and testing by progressively re-enabling them. Here is a schematic step by step list, to test whether a possible malfunction comes from WooCommerce B2B:

  1. Disable all plugins, except WooCommerce and WooCommerce B2B
  2. Make a test
    • If the problem persists, the cause is WooCommerce B2B
      Only in this case, contact WooCommerce B2B support
    • If the problem is solved, enable one of the previously disabled plugins and repeat from point (2), until you find plugin that causing it
      In this case, contact that plugin support

But in some cases, your site may be live (although it is always recommended to have a testing or staging copy) and this approach is difficult.

WooCommerce B2B debug mode

Our team has implemented a solution for this! It is possible to enable a special debug mode, which disables all plugins except WooCommerce and WooCommerce B2B, but only for the IP address of the user who enables it.

In this way, all other users and customers will continue to use the site in its entirety without problems or inconveniences.

This allows you to work calmly and find out if the problem you are experiencing is caused by WooCommerce B2B.

Enable debug mode
  1. Login to your WordPress Dashboard
  2. Go to "WooCommerce > Settings > B2B > Tools" tab
  3. Read instructions carefully
  4. Click "Enable" button
  5. Perform your tests to check if the problem persists
WooCommerce > Settings > B2B > Tools tab
# 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
WooCommerce > Settings > Shipping tab > Classes

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 or by min/max cart amount.

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
  • Payment method
    customization
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). It can be enabled based on shipping method chosen by customer or by min/max cart amount.

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

  • Checkout page
  • Payment method
    customization
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 or by min/max cart amount.

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
  • Payment method
    customization
  • 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.

Use quotations to make offers

Some companies that also use WooCommerce to manage telephone or email orders, WooCommerce B2B quotations can be very useful.

Consider that an operator can create an order from the backend (as provided by default by WooCommerce):

Orders > Add New

and choose "Quoted" as the status. In this way, customer will receive your best offer and will be able to view it in his MyAccount area, where he will eventually be able to accept the quote and pay for the order just entered.

Shipping class delivery days
Description

You can set the min/max delivery days associated with the shipping class, to build the estimated delivery time.


Note: it requires "Show delivery time" option in WooCommerce B2B groups page is enabled.
Screenshots

  • Shippings class page

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
Delivery weekdays
Description

Select the days of the week to be considered working days for delivery.

Holidays
Description

Select dates (day/month) of holidays not to be considered in delivery dates calculation.

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 enabled.
Note: it requires "Tax rates" option in WooCommerce settings page (Tax tab) is setup.
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.

For more information, see:

Email address for invoices
Description

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

Multiple options to enable email address for invoices management:

  • Hidden: don't show "Email address for invoices" field.
  • Required: show "Email address for invoices" field as required.
  • Optional: show "Email address for invoices" field as not required (optional).
Note: Plugin doesn't send email on this address, this is a customer preference to receive invoices.
Screenshots

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

Add an additional field in checkout in which customers can communicate their VAT number.

Multiple options to enable VAT management:

  • Hidden: don't show "Vat number" field.
  • Required: show "Vat number" field as required.
  • Optional: show "Vat number" field as not required (optional).
Screenshots

  • Checkout page
  • Admin order details
  • Admin customer page
VIES validation
Description

Enable VIES validation in checkout for EU customers on VAT number field.

Multiple options to enable VIES validation management:

  • Disabled: don't trigger VIES validation.
  • Enabled (Strict): enable VIES validation and block purchase if error occurs or validation fails.
  • Enabled (Lax): enable VIES validation but allow purchase evenif error occurs or validation fails.
Note: 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) Note: VIES validation response can be viewed in backend user edit page.
Customization

You can customize redirect by using dedicated hooks:

Screenshots

  • VIES validation
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
Roles to consider as customer
Description

By default, WooCommerce B2B allows you to apply groups to users with the default role "customer". Optionally, choose which roles you want to extend this behavior to.

Note: Please be sure to have at least "customer" role selected.
Note: It's highly not recommended to remove the "customer" role from this list to prevent malfunctions.
Customization

You can customize roles by using dedicated hooks:

Automatic group change
Description

Enable the automatic movement of users between groups based on their total purchase amounts.

Screenshots

  • Settings page
Quotation endpoint
Description

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

Quotation validity
Description

Allows you to set how many days a quotation is valid for. When a quotation is processed and put in the "Quoted" status, the maximum validity date is calculated based on the value in days entered. The validity date is displayed on the order page in the backend, on the quotation detail page in MyAccount and in the "Quoted" summary email. Once the validity expires, the "Pay now" button is no longer displayed and the customer can no longer finalize the purchase.

Note: Set 0 to disable validity calculation.
Screenshots

  • Admin order page
  • My account page
  • Quoted email
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
Settings page Tools
WooCommerce > Settings > B2B > Tools tab

Debug mode
Description

Debug mode is a very useful feature that disables all plugins except WooCommerce and WooCommerce B2B only for your IP address. It allows you to test and verify any malfunctions without any interference, to understand if they are caused by WooCommerce B2B and save you debugging time.

Note: this feature is experimental, enable it at your own risk!
Customization

You can customize default always enabled plugins by using dedicated hooks:

Screenshots

  • Tools tab

Group options
Users > All Groups > {Group}

Hide prices
Description

Removes the possibility of viewing the prices of the products depending on the group they belong to, 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, so no purchase can be made by customers depending on the group they belong to.

Screenshots

  • Product page
  • Shop page
Allow quotations
Description

Allow quotations even if prices are hidden.

On the loop and single product pages, prices are still not displayed, while prices, totals and subtotals in the cart and checkout are replaced with the text "To be quoted". The text of the add to cart buttons becomes "Add to quotation".

Note: Please be sure quotations payment gateway is enabled.
Screenshots

  • Product page
  • Shop page
  • Cart page
  • Checkout 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.
Screenshots

  • Admin group page
Global discount percentage
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 groups edit 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
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
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 enabled.
Note: it requires "Tax rates" option in WooCommerce settings page (Tax tab) is setup.
Note: it override default WooCommerce "Display prices in the shop" and "Display prices during cart and checkout" options.
Screenshots

  • Admin group page
  • Product 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 enabled.
Note: it requires "Tax rates" option in WooCommerce settings page (Tax tab) is setup.
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.

Screenshots

  • Admin group page
  • Cart page
  • Checkout page
Min purchase alert (cart)
Description

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.

Customization

You can customize message by using dedicated hooks:

Screenshots

  • Admin group page
  • Cart page
Min purchase checkout button (checkout)
Description

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.

Customization

You can customize message by using dedicated hooks:

Screenshots

  • Admin group page
  • Cart page
Save cart
Description

Show an additional button in cart page that allow logged in customers to save their cart content for later. Saved carts can be managed and restored from customer MyAccount page.

Screenshots

  • Admin group page
  • Cart page
  • My account page
New order email additional recipients
Description

In WooCommerce, by default, new order emails are sent to chosen recipient(s) when a new order is received. With WooCommerce B2B you can add additional recipients based on the group of the customer who placed the order.

Note: you can add multiple recipients, separated by commas.
Screenshots

  • Admin group page
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
Show delivery time
Description

Show product delivery time in single product page, in cart, in checkout, in emails and in backend order details.

To setup and show delivery time correctly, you need to:

  1. Go to: "WooCommerce" -> "Settings" -> "B2B" tab and set your delivery week days and delivery holidays
  2. Go to: "WooCommerce" -> "Settings" -> "Shippings" tab -> "Shipping classes" and configure one or more shipping classes with defined "Delivery days (min)" and "Delivery days (max)" options
  3. Go to: "Products" -> "Edit product" -> "Shippings" tab and set a shipping class, according to delivery days range you want to apply. You can also use WooCommerce import/export tools to bulk insert/update
  4. Go to: "Groups" -> "Edit group" and enable "Show delivery time" option
Screenshots

  • Admin shippings page
  • Admin product page
  • Admin group page
  • Product page
  • Cart page
Customization

You can customize message position by using dedicated hooks:

Shipping class
Description

Show product shipping class in single product page.

Screenshots

  • Admin group page
  • Admin product page
  • Product page
Barcode
Description

Show product barcode in single product page.

Customization

You can customize barcode displaying by using dedicated hooks:

Screenshots

  • Admin group page
  • Admin product page
  • Product 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

  • Admin group page
  • Product page
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

  • Admin group page
  • Product page
Total sales
Description

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

Screenshots

  • Admin group page
  • Product page
Shippings tab
Description

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

Screenshots

  • Admin group page
  • Product page
Purchase history tab
Description

Add an additional tab with customer previous purchases list on product detail page.

Screenshots

  • Admin group page
  • Product page
Email address for invoices
Description

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

Multiple options to enable email address for invoices management:

  • Hidden: don't show "Email address for invoices" field.
  • Required: show "Email address for invoices" field as required.
  • Optional: show "Email address for invoices" field as not required (optional).
Note: it requires "Extend registration fields" option in group page is enabled.
Screenshots

  • Registration page
Vat number
Description

Add an additional field in groups registration forms in which customers can communicate their VAT number.

Multiple options to enable VAT management:

  • Hidden: don't show "VAT number" field.
  • Required: show "VAT number" field as required.
  • Optional: show "VAT number" field as not required (optional).
Note: it requires "Extend registration fields" option in group page is enabled.
Screenshots

  • Registration page
VIES validation
Description

Enable VIES validation in registration forms for EU customers on VAT number field.

Multiple options to enable VIES validation management:

  • Disabled: don't trigger VIES validation.
  • Enabled (Strict): enable VIES validation and block purchase if error occurs or validation fails.
  • Enabled (Lax): enable VIES validation but allow purchase evenif error occurs or validation fails.
Note: 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) Note: VIES validation response can be viewed in backend user edit page.
Customization

You can customize redirect by using dedicated hooks:

Screenshots

  • VIES validation
Business certificate
Description

Add an additional field in groups registration forms to allow customers to upload their company business certificate.

Multiple options to enable business certificate management:

  • Hidden: don't show "Business certificate" field.
  • Required: show "Business certificate" field as required.
  • Optional: show "Business certificate" field as not required (optional).
Customization

You can customize form by using dedicated hooks:

Screenshots

  • Registration page
  • My account page
Extend registration fields
Description

Extend group 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
Moderate registration
Description

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

  • Admin group page
  • Admin customer page
  • Active account
    email customization
  • Registration page
  • Active account email
  • New account email
Unpaid amount
Description

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

Screenshots

  • Admin group page
  • Checkout page
  • My account page
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

  • Admin group page
  • My account page
Discount % in myaccount
Description

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

Note: it requires "Price rules" option in groups edit 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

  • Admin group page
  • My account page
Discount % in product
Description

Allow customers to see discount percentage assigned to them in each single product page.

Note: it requires "Price rules" option in groups edit 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

  • Admin group page
  • Product 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 depends on "Moderate registration" option in groups.
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}

Product visibility by group
Description

Allows you to hide the individual product based on customer group.

Customization

If you have a large number of variable products with many variations you can improve performance and prevent slow down by using dedicated hooks:

Screenshots

  • Admin product page
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 enabled.
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 pricesby quantity 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

By default, tier prices table is interactive, so when a customer increase or decrease product quantity, matching tier price line is highlighted. If you prefer, you can disable this behavior with the dedicated hook in next "Customization" section.

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:

  • Product visibility
  • Groups increment quantity (packages)
  • Groups minimum quantity
  • Groups maximum quantity
  • Group hide stocks
  • Groups hide prices
  • 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

Sales agent dashboard
Dashboard > Customers
Dashboard > Customers > {Customer}

Customer group
Description

View customer group in customers list and customers details pages in sales agent dashboard.

Screenshots

  • Customers list
  • Customers details



WooCommerce B2B special features to improve compatibility and sinergy with WooCommerce B2B Warehouses
(*) Note: these options will appear only if WooCommerce B2B Warehouses plugin is installed and active.

Group page
Users > All Groups > {Group}

Group warehouse
Description

Assign a group warehouse to force picking when a customer assigned to this group make an order.

Note: if group dedicated warehouse is set, other warehouses will be not considered.
Screenshots

  • Admin group page

Warehouse page
WooCommerce > Warehouses > {Warehouse}

Extra delivery days
Description

Add/Subtracts days to extimated delivery days for this warehouse.

Note: it needs WooCommerce B2B "Shipping class delivery days" option is set.
Screenshots

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

Related purchases
Shortcode
[wcb2bpurchasesrelated]
Description

Shows products related to customer latest completed orders.

Parameters

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

last_orders: integer, number of latest orders to consider to get related products. Default: 10

Screenshots

  • Example page
  • Shortcode usage

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.

Note: to enable registration form please be sure you have enabled "Allow customers to create an account on the 'My account' page" option in WooCommerce account & privacy settings.
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.

You can translate WooCommerce B2B using special translation plugins, such as WPML for example. To know more about WPML configuration, take a look to: WooCommerce B2B compatibility with wpml.

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


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.

CLICK HERE to quick look hooks list

Available hooks summary

Here the full 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;
}
Get customer group
Description

Allow to alter the customer group on the fly, without store it in database.

Definition
apply_filters( 'wcb2b_get_customer_group', integer $group_id, integer $user_id );
Example

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

add_filter( 'wcb2b_get_customer_group', 'fn_wcb2b_get_customer_group', 10, 2 );
function fn_wcb2b_get_customer_group( $group_id, $user_id ) {
    // Force group with ID 100 to user with ID 10
    if ( $user_id == 10 ) {
        $group_id = 100;
    }
    return $group_id;
}
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.

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, object $product_id, $variation );
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', 10, 4 );
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 );
}
Manage visibility by all variations
Description

In case of variable products, a more thorough check is performed than the visibility of the product per group. In practice, in a variable product with all variations flagged as not visible per group, the entire product will be considered not visible.

Note: this is a redundancy check, as it is still possible to set the product visibility per group even to the variable product itself, regardless of its variations.
Note: in case of many variable products and with many variations, this control can degrade performance and it is recommended to disable it, remembering to check and configure the visibility of the parent product if necessary.em>
Definition
apply_filters( 'wcb2b_manage_visibility_by_all_variations', boolean $enable, integer $product_id );
Defaults
$enable = true;
Example

To disable advanced and redundant control of variable product visibility per group, you can add this code to your functions.php file:

add_filter( 'wcb2b_manage_visibility_by_all_variations', 'fn_wcb2b_manage_visibility_by_all_variations', 10, 2 );
function fn_wcb2b_manage_visibility_by_all_variations( $enable, $product_id ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_manage_visibility_by_all_variations', '__return_false' );
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;
}
Delivery min days
Description

Alter the number of minimum days to delivery.

Definition
apply_filters( 'wcb2b_delivery_days_min', integer $days_min, integer, $product_id );
Example

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

add_filter( 'wcb2b_delivery_days_min', 'fn_wcb2b_delivery_days_min', 10, 2 );
function fn_wcb2b_delivery_days_min( $days_min, $product_id ) {
    if ( 100 == $product_id ) {
        return 5;
    }
    return $days_min;
}
Delivery max days
Description

Alter the number of maximum days to delivery.

Definition
apply_filters( 'wcb2b_delivery_days_max', integer $days_max, integer, $product_id );
Example

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

add_filter( 'wcb2b_delivery_days_max', 'fn_wcb2b_delivery_days_max', 10, 2 );
function fn_wcb2b_delivery_days_max( $days_max, $product_id ) {
    if ( 100 == $product_id ) {
        return 5;
    }
    return $days_max;
}
Estimated delivery time default hook
Description

Establishes the hook to use to display estimated delivery time message to change position.

Definition
apply_filters( 'wcb2b_estimated_delivery_hook', string $hook );
Defaults
$hook = 'woocommerce_after_add_to_cart_button';
Example

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

add_filter( 'wcb2b_estimated_delivery_hook', 'fn_wcb2b_estimated_delivery_hook' );
function fn_wcb2b_estimated_delivery_hook( $hook ) {
    return 'woocommerce_before_add_to_cart_button';
}
Tier prices default hook
Description

Establishes the hook to use to display tier prices for simple products to change position.

Note: in versions prior to 3.3.9 of WooCommerce B2B the default hook was "woocommerce_single_product_summary", in subsequent versions it instead became "woocommerce_before_add_to_cart_form", to improve compatibility with blocks and visual builders (like Elementor PRO).
Definition
apply_filters( 'wcb2b_simple_tier_prices_hook', string $hook );
Defaults
$hook = 'woocommerce_before_add_to_cart_form';
Example

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

add_filter( 'wcb2b_simple_tier_prices_hook', 'fn_wcb2b_simple_tier_prices_hook' );
function fn_wcb2b_simple_tier_prices_hook( $hook ) {
    return 'woocommerce_single_product_summary';
}
Tier prices interactive mode
Description

Enable/Disable interactive mode on tier prices table in product page.

Definition
apply_filters( 'wcb2b_interactive_tier_prices', boolean $enable );
Defaults
$enable = true;
Example

To disable tier prices interactivity, you can add this code to your functions.php file:

add_filter( 'wcb2b_interactive_tier_prices', 'fn_wcb2b_interactive_tier_prices' );
function fn_wcb2b_interactive_tier_prices( $enable ) {
    return false;
}

Or, alternatively:

add_filter( 'wcb2b_interactive_tier_prices', '__return_false' );
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.

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 groups edit 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 groups edit 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 groups edit 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 groups edit 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 ) );
}
Empty cart button markup
Description

Customize button "Empty cart" markup in cart page.

Definition
apply_filters( 'wcb2b_empty_cart_button_html', string $button );
Defaults
$button = sprintf( '<button type="submit" class="button wp-element-button" name="wcb2b_cart_empty" value="1"'>%s'</button>',
    esc_html( 'Empty cart', 'woocommerce-b2b' )
);
Example

To change button HTML, you can add this code to your functions.php file:

add_filter( 'wcb2b_empty_cart_button_html', 'fn_wcb2b_empty_cart_button_html' );
function fn_wcb2b_empty_cart_button_html( $button ) {
    $button = sprintf( '<button type="submit" class="mycustomclassbutton" name="wcb2b_cart_empty" value="1">%s</button>',
        esc_html( 'My custom button label', 'woocommerce-b2b' )
    );
    return $button;
}

To disable "Empty cart" button:

add_filter( 'wcb2b_empty_cart_button_html', '__return_false' );
Order again statuses
Description

Customize order statuses on which enable "Order again" button in MyAccount orders list.

Definition
apply_filters( 'wcb2b_order_again_statuses', array $statuses );
Defaults
$statuses = array( 'completed' );
Example

To add a new status to enable "Order again" button, you can add this code to your functions.php file:

add_filter( 'wcb2b_order_again_statuses', 'fn_wcb2b_order_again_statuses' );
function fn_wcb2b_order_again_statuses( $statuses ) {
    $statuses[] = 'pending';
    return $statuses;
}

To disable "Order again" button:

add_filter( 'wcb2b_order_again_statuses', 'fn_wcb2b_order_again_statuses' );
function fn_wcb2b_order_again_statuses( $statuses ) {
    return array();
}
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 groups edit 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 groups edit 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 dedicated login/registration page and not for default my-account page.

Note: it requires "Extend registration forms" option in groups 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_dedicated );
Defaults
$only_dedicated = 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( $only_dedicated ) {
    return true;
}

Or, alternatively:

add_filter( 'wcb2b_extend_registration_form_b2b_only', '__return_true' );
Business certificate field options
Description

Allow to customize "Business certificate" field parameters.

Note: it requires "Business certificate" option in groups page is enabled.
Definition
apply_filters( 'wcb2b_business_certificate_args', array $args, integer, $group_id );
Defaults
$args = array(
    'can_edit' => true,         // Customer can change business certificate from "MyAccount -> Account details" page
    'value'    => {INTEGER},    // Current attachment ID (if already uploaded)
    'required' => {BOOLEAN},    // If field is required, by default depends on group option
    'maxsize'  => 10485760,     // Max files size allowed in bytes (10 MB by default)
    'allowed'  => array(        // Allowed mime types to upload, by default all images and PDF
        'image/*',
        '.pdf'
    )
);
Example

To change default max size allowed for uploaded files, you can add this code to your functions.php file:

add_filter( 'wcb2b_business_certificate_args', 'fn_wcb2b_business_certificate_args', 10, 2 );
function fn_wcb2b_business_certificate_args( $args, $group_id ) {
    $args['maxsize'] = 20971520; // 20 MB
    return $args;
}
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', 10, 2 );
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, integer $customer_group_id );
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', 10, 2 );
function fn_wcb2b_register_form_fields( $fields, $customer_group_id ) {
    $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', 10, 2 );
function fn_wcb2b_register_form_fields( $fields, $customer_group_id ) {
    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 "VIES validation" option in WooCommerce B2B settings page (for checkout) or in group settings (for registration) 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 VIES validation responses list
Description

Customize VIES validation response messages.

Note: it requires "VIES validation" option in WooCommerce B2B settings page (for checkout) or in group settings (for registration) is enabled.
Definition
apply_filters( 'wcb2b_vies_responses', array $responses );
Defaults
$params = array(
    'OK'                        => esc_html__( 'Valid', 'woocommerce-b2b' ),
    'WRONG'                     => esc_html__( 'VAT number is not verified by VIES', 'woocommerce-b2b' ),
    'INVALID_INPUT'             => esc_html__( 'The provided country is invalid or the VAT number is empty', 'woocommerce-b2b' ),
    'GLOBAL_MAX_CONCURRENT_REQ' => esc_html__( 'Your request cannot be processed due to high traffic, please try again', 'woocommerce-b2b' ),
    'MS_MAX_CONCURRENT_REQ'     => esc_html__( 'Your request cannot be processed due to high traffic from your country, please try again', 'woocommerce-b2b' ),
    'SERVICE_UNAVAILABLE'       => esc_html__( 'Server is currently unreachable, please try again', 'woocommerce-b2b' ),
    'MS_UNAVAILABLE'            => esc_html__( 'Server is currently unreachable from your country, please try again', 'woocommerce-b2b' ),
    'TIMEOUT'                   => esc_html__( 'Server did not respond within time limit, please try again', 'woocommerce-b2b' ),
    'UNKNOWN'                   => esc_html__( 'An unknown error has occurred, please try again', 'woocommerce-b2b' )
);
Example

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

add_filter( 'wcb2b_vies_responses', 'fn_wcb2b_vies_responses' );
function fn_wcb2b_vies_responses( $responses ) {
    // Change WRONG Vat number from list
    $responses['WRONG'] = esc_html__( 'Sorry, but the VAT number you entered appears to be incorrect', 'woocommerce-b2b' );
    return $responses;
}
Customize Quick Order parameters
Description

Customize Quick Order parameters to pass to handler used to parse CSV file.

Definition
apply_filters( 'wcb2b_quickorder_params', array $params );
Defaults
$params = array(
    'separator' => ';',
);
Example

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

add_filter( 'wcb2b_quickorder_params', 'fn_wcb2b_quickorder_params' );
function fn_wcb2b_quickorder_params( $params ) {
    // Change CSV separator to comma (,)
    $params['separator'] = ',';
    return $params;
}
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.

Empty current cart on saved cart restore
Description

If true, the current cart will be emptied when a customer restores a previously saved cart.

If false, the contents of the current cart and the saved cart will be merged.

Definition
apply_filters( 'wcb2b_empty_cart_on_save', boolean $enable );
Defaults
$enable = true;
Example

To prevent current cart emptying when restoring a previously saved one, you can add this code to your functions.php file:

add_filter( 'wcb2b_empty_cart_on_save', 'fn_wcb2b_empty_cart_on_save' );
function fn_wcb2b_empty_cart_on_save( $enable ) {
    return false;
}
                    

Or, alternatively:

add_filter( 'wcb2b_empty_cart_on_save', '__return_false' );
Redirect to cart page on saved cart restore
Description

If true, when a customer restore a saved cart from his myaccount area, he will be redirected to cart page.

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

To redirect on cart page when restoring a previously saved cart, you can add this code to your functions.php file:

add_filter( 'wcb2b_redirect_on_restore_saved_cart', 'fn_wcb2b_redirect_on_restore_saved_cart' );
function fn_wcb2b_redirect_on_restore_saved_cart( $redirect ) {
    return true;
}
                    

Or, alternatively:

add_filter( 'wcb2b_redirect_on_restore_saved_cart', '__return_true' );
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;
}
Debug mode always enabled plugins
Description

List of always enabled plugins, also in debug mode.

Definition
apply_filters( 'wcb2b_debug_muplugins', array $plugins );
Defaults
$plugins = array(
    'woocommerce/woocommerce.php',
    'woocommerce-b2b/woocommerce-b2b.php'
);
Example

To add a new plugin to consider always enabled, you can add this code to your functions.php file:

add_filter( 'wcb2b_debug_muplugins', 'fn_wcb2b_debug_muplugins' );
function fn_wcb2b_debug_muplugins( $plugins ) {
    $plugins[] = 'your-plugin-folder/your-plugin-file.php';
    return $plugins;
}
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_loaded', 'fn_wcb2b_loaded' );
function fn_wcb2b_loaded() {
    // Make action magic happen here...
}
# REST API support
Manage WooCommerce B2B data with extended REST API.

WooCommerce B2B is perfect integrated and extends default WooCommerce REST API to manage its own custom fields.

For more informations, please visit: WordPress Official documentation

Note: alias fields are provided only in GET response, to manage WooCommerce B2B additional data in PUT or POST methods please refer to default meta data management as described in WooCommerce official documentation


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_hide_prices: contains flag to enable/disable prices visibility
    Value can be 0 (=visible) or 1 (=hidden)
    In API GET response, has also a dedicated field alias named "wcb2b_group_hide_prices"
  • wcb2b_group_price_rule: contains specific price rule for group
    Value is a string
    In API GET response, has also a dedicated field alias named "wcb2b_group_price_rule"
  • 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"
  • 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_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_tax_exemption: contains flag to enable/disable tax exemption
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_tax_exemption"
  • wcb2b_group_tax_display: contains indication whether product prices should be displayed including or excluding taxes
    Value can be 'incl' (=including taxes) or 'excl' (=excluding taxes)
    In API GET response, has also a dedicated field alias named "wcb2b_group_tax_display"
  • wcb2b_group_price_suffix: contains suffix text to add to price display
    Value is a string
    In API GET response, has also a dedicated field alias named "wcb2b_group_price_suffix"
  • wcb2b_group_add_invoice_email: contains value to render invoice email address for billing field
    Value can be "hidden"/"required"/"optional"
    In API GET response, has also a dedicated field alias named "wcb2b_group_add_invoice_email"
  • wcb2b_group_add_vatnumber: contains value to render VAT number field
    Value can be "hidden"/"required"/"optional"
    In API GET response, has also a dedicated field alias named "wcb2b_group_add_vatnumber"
  • wcb2b_group_extend_registration_fields: contains flag to enable/disable moderate registration
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_extend_registration_fields"
  • wcb2b_group_moderate_registration: contains flag to enable/disable moderate registration
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_moderate_registration"
  • 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"
  • 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_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_show_deliverytime: contains flag to show delivery time in product page, cart, checkout, email, order details
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_show_deliverytime"
  • wcb2b_group_show_barcode: contains flag to enable/disable barcode showing in product page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_show_barcode"
  • wcb2b_group_show_rrp: contains flag to enable/disable RRP showing in product page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_show_rrp"
  • wcb2b_group_already_bought: contains flag to enable/disable "already bought" message in product page when customer has already purchased the item
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_already_bought"
  • wcb2b_group_show_sales: contains flag to show sales counter in product page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_show_sales"
  • wcb2b_group_shippings_tab: contains flag to show dedicated tab to summarize available shippings in product page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_shippings_tab"
  • wcb2b_group_purchase_history_tab: contains flag to show dedicated tab to show purchase history in product page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_purchase_history_tab"
  • wcb2b_group_show_unpaid: contains flag to show unpaid orders amount total in myaccount page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_show_unpaid"
  • wcb2b_group_show_groupname: contains flag to show assigned group name in myaccount page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_show_groupname"
  • wcb2b_group_show_discount_myaccount: contains flag to show discount percentage (according to "Price rule" option value) in myaccount page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_show_discount_myaccount"
  • wcb2b_group_show_discount_product: contains flag to show discount percentage (according to "Price rule" option value) in product page
    Value can be 0 (=disabled) or 1 (=enabled)
    In API GET response, has also a dedicated field alias named "wcb2b_group_show_discount_product"

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_hide_prices": "1",
    "wcb2b_group_price_rule": "single",
    "wcb2b_group_discount": "40",
    "wcb2b_group_packaging_fee": {
        "type": "percent",
        "value": "3"
    },
    "wcb2b_group_min_purchase_amount": "500",
    "wcb2b_group_tax_exemption": "1",
    "wcb2b_group_tax_display": "incl",
    "wcb2b_group_price_suffix": "(tax included)",
    "wcb2b_group_add_invoice_email": "optional",
    "wcb2b_group_add_vatnumber": "required",
    "wcb2b_group_extend_registration_fields": 1,
    "wcb2b_group_moderate_registration": "1",
    "wcb2b_group_gateways": [
        "bacs",
        "cheque"
    ],
    "wcb2b_group_shippings": [
        "flat_rate"
    ],
    "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_show_deliverytime": "1",
    "wcb2b_group_show_barcode": "1",
    "wcb2b_group_show_rrp": "1",
    "wcb2b_group_already_bought": "1",
    "wcb2b_group_show_sales": "1",
    "wcb2b_group_shippings_tab": "1",
    "wcb2b_group_purchase_history_tab": "1",
    "wcb2b_group_show_unpaid": "1",
    "wcb2b_group_show_groupname": "1",
    "wcb2b_group_show_discount_myaccount": 1"",
    "wcb2b_group_show_discount_product": "1"
}
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 categories API
Description

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

WooCommerce B2B available meta fields:

  • wcb2b_group_visibility: contains the IDs of the groups flagged as visible for the product category.
    Value is an array

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 product categories)
get
/wp-json/wc/v3/products/categories

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

Example response
{
    "id": 44,
    "name": "Clothing",
    "slug": "cclothing",
    "parent": 0,
    "description": "",
    "display": "default",
    "image": null,
    "menu_order": 0,
    "count": 1,
    "meta": {
        "order": [
            "0"
        ],
        "wcb2b_group_visibility": [
            "a:1:{i:0;i:13683;}"
        ],
        "product_count_product_cat": [
            "1"
        ]
    },
    "_links": {
        "self": [
            {
                "href": "https:\/\/demo.woocommerce-b2b.com\/wp-json\/wc\/v3\/products\/categories\/44"
            }
        ],
        "collection": [
            {
                "href": "https:\/\/demo.woocommerce-b2b.com\/wp-json\/wc\/v3\/products\/categories"
            }
        ]
    }
}
HTTP request (create product category)
post
/wp-json/wc/v3/products/categories/

Example data
{"name": "Jewels", "slug": "jewels", "meta": {wcb2b_group_visibility":[11,15]}}
                                    

HTTP request (update product category)
put
/wp-json/wc/v3/products/categories/{ID}

Example data
{"meta": {"wcb2b_group_visibility":[15]}}
                                    

HTTP request (delete product category)
delete
/wp-json/wc/v3/products/categories/{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_visibility: contains groups with for which product is hidden.
    Value is an array with GROUP IDs.
    In API GET response, has also a dedicated field alias named "wcb2b_group_visibility"
  • 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": 285124,
            "key": "wcb2b_product_group_visibility",
            "value": [
                275
            ]
        },
        {
            "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_visibility": [
        [
          275
        ]
    ],
    "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/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 customer 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.
  • templates/myaccount/business-certificate-field.php: address details form to upload business certificate in my account area.
  • templates/myaccount/saved-carts.php: saved carts tab list in my account area.
  • 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/single-product/tabs/purchase-history.php: shows additional tab with product purchase history summary table on product detail page.
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-pluggable-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

To know more about WPML configuration, take a look to: WooCommerce B2B compatibility with wpml.

This is a simple guide to configure WooCommerce B2B and WPML to work in the best way.

# 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