Setting up a Multi-vendor Marketplace Using Commercetools

03 Jul, 2020 | 4 minutes read

In our previous blog posts, we have covered the importance of e-commerce, the need to have a modern and fully functional e-commerce website, as well as creating e-commerce website fast with Commercetools. If you are a business owner investing in the field of e-commerce and have a strategic goal to extend your business in the multi-vendor marketplace, then maybe you should start considering making a multiple vendors e-commerce website.

There are two main reasons why a multi-vendor marketplace might become the next trend:

  1. Increased customers’ level satisfaction because your customers will get to choose from a wide variety of products, digital and/or physical, and
  2. As an owner of the e-commerce website, you will charge your vendors a commission, so both you and the vendors will be satisfied.

Once you decide to set up a multi-vendor marketplace, you should look at the essential features of it, and make sure that the platform you will use to create it covers all of them. These features can be divided into two categories: 1) features from a vendor’s perspective, and 2) features from an admin’s perspective.

Vendor’s Perspective

  • Easy registration/listing for vendors
  • Individual admin panel and mini store for the vendor
  • Language translation
  • Vendor location
  • Shipping methods option – the vendors should be able to set ad choose the shipping method (DHL, UPS, FedEx etc.)
  • Comments and reviews
  • All types of detailed reports & statistics – time period, product, price etc.

Admin’s Perspective

  • Ability to register employees and assign roles
  • Creating subscription plans for vendors functionality
  • A flexible product approval system
  • Option for enabling and disabling menus and setting privileges
  • Advanced Vendor Payout System
  • Vendor debt payout option
  • Detailed reports and statistics that will provide information about website traffic and marketing effectiveness.

Once you have outlined your vision and idea, mapped them with the want-to-have features, you need to find a multi-vendor marketplace software that will turn your idea into reality. There is a wide variety of multi-vendor marketplace software on the Internet, and Commercetools is one of the platforms that can be used to put your e-commerce website on the next level.  

Using Commercetools to create your next multi-vendor marketplace

Before we jump into the technical specification, let’s see what Commercetools offers as a multitenant platform. Commercetools’ architecture is based on API approach, which is a significant key point of one multi-tenant system. If you wonder why, imagine this: your business includes multiple companies, with multiple stores across one or more countries. Very often the business can be closely connected to the place where it is located, so you will have different products in different locations because all of them will function independently without any control over the inventory. So, if you have different e-commerce shops where your customers can list, see and order your products, whenever you make a change at a certain product in one e-commerce shop, you will have to do that in all others.

Commercetools comes to the rescue here. Having the API approach for all the entities in the cloud platform, it offers easy maintenance of the inventory list, and full flexibility as to the way products are displayed in different shops. You can consider that each vendor has a unique Commercetools profile, where they can maintain their products they want to sell in the shops. This state-of-the-art architecture is the perfect starting point for customized microservices, enabling business owners to significantly reduce time-to-market for innovative commerce functionalities.

Now, let’s move to the technical part. Setting up a multi-vendor marketplace is a really easy process in Commercetools. One of the many approaches to create a multi-tenant shop is to use different sub-domains. Each subdomain will represent a  unique vendor/shop. When a user successfully connects to the location in the URL the head of the system will adjust its query (access_token & shop_id) to ping Commercetools and receive data needed for that specific vendor.

So, the location will look something like this:

  • https://shoes.clothingworld.com
  • https://accessories.clothingworld.com

When the call is made we will extract the subdomain and fetch the appropriate items based on the parameters we typed above.

The next thing to note is the database:

We need to have a “companies” table which contains the subdomain or id (whichever you prefer) for fetching the related vendor info. The database columns look like this:

ID
Subdomain
access_token
store_id

The access token is the API key and store_id is the provided commerce_tools store id. We will take these parameters and make the parameters look something like this:

$this->config = [
    ‘client_id’ => env(‘COMMERCE_TOOLS_CLIENT_ID’),
    ‘client_secret’ => env(‘COMMERCE_TOOLS_CLIENT_SECRET’),
    ‘project’ => env(‘COMMERCE_TOOLS_PROJECT_ID’),
];

But instead of drawing them from the .env file we will take the values from the database.

In the future, Commercetools will support multiple stores out of the box using this approach https://docs.commercetools.com/http-api-projects-stores.  But for now, you have to handle multiple stores directly from the head module.

This is in essence a multitenant architecture where the company_id is not added to the query but added to the parameters because we use Commercetools for all related queries.

Having in mind the path that e-commerce has taken, and the speed at which it changes the shopping behavior, there is no doubt that multi-vendor marketplaces will soon become the next stop for most of the e-commerce business owners. So, why not be the first?