For a multi-vendor e-commerce website, or a marketplace, the vendors can be placed across the globe. For the sake of an example, say your e-store operates in the US. And let’s assume that along with the US, you have vendors from France and China, as well. If you have set up your WooCommerce products store, and offer products from different vendors, you might face a problem setting up shipping rates. The cost of shipping a product from one corner of the US to another, will be much lower, than shipping from China to Boston.
Using Shipping Classes
WooCommerce provides shipping classes, which you can use, to differentiate between goods which can be shipped together. Thus products from a particular vendor can be listed under a single shipping class. Using the shipping class we can set a particular cost of shipping.
If you use the WooCommerce Product Vendors extension, for your marketplace, you can allow different vendors to set up and manage the products they sell. By default the vendors cannot create shipping classes or set the shipping rates. We would need some customization to automate the process.
Customizing the Product Vendors Extension
In our case, shipping rates will be based on shipping classes, which in turn will depend on product vendors. We will need a customization, to provide a way using which, vendors would be able to create shipping classes and set prices accordingly. The flow of the use case will be as follows:
- Vendor sees a settings page, where he can create a shipping class and set a cost for the class.
- This shipping class is automatically added to every product the vendor adds, and the product price is adjusted accordingly.
- In the front end, this shipping rate will be clearly indicated on the product page or during check-out.
- If the shipping location is different (multiple countries), we will have to allow vendors to set multiple rates for a shipping class, depending on the shipping location (country, state, etc).
- Upon inferring the shipping address from the customer, we will have to dynamically set the shipping rate for the product.
Fair pricing is important for the customer as well as the vendor. When static shipping rates no longer suffice, dynamic shipping rates, depending on vendor and customer location, in WooCommerce, can be achieved using a custom extension or plugin modification.