How to assemble several online shops with Woocommerce and a common shopping cart

online shopping

Before starting, I must make a plea for online stores with Woocommerce because many will be thinking that ecommerce is not mounted with WordPress + Woocommerce. And I tell you that you’re wrong.

Woocommerce Yes or no

There are several reasons to mount an online store with Woocommerce and not to use Prestashop, Magento or other SaaS solutions for creating online stores Shopify type:

  • With WP + Woo you need less resources to start up the online store: Ideal to test a market, test a range of products, start selling online when you already have a physical store, etc. By resources we understand power of web hosting, hours of work and price of the technical workforce. If we want to compare, WP + Woo moves with half the power that Prestashop and the fourth part of Magento. Professionals who can launch an online store with Woocommerce (including customizations, not only install), there are many, for any other technology scarce (and therefore are more expensive).
  • Woo’s learning curve is very fast (graphically a very steep curve).
  • Woo allows fast customization of many features, faster and more convenient than a SaaS.
  • All the functionality extension plugins for Woo work and do what they say. 75% of Prestashop’s modules do not work properly.
  • There are more than 50mil products maintained with Woocommerce, why aren’t you going to be able to do it?

Now I’m going to give you one more reason to use WP + Woo: You can have several online stores with the same shopping cart. This functionality is offered by Magento for a long time, but if your budget in technology is limited and you find yourself in one of the above situations, that is not a valid option.

It is true that if you want to have several different stores your e-commerce project seems to be big enough to consider the use of a “big” technology. Or not. Your ecommerce project may have the feature of needing several independent online stores, even if they are small, to test different markets or different product ranges, and at the same time it is interesting to have a single cart of the common purchase.

The use of Woocommerce as software for an online store is recommended by some of the best developing personalized online stores. You can read the article sngular on ecommerce top 100.

Technical explanation for non-technicians about the shopping cart

The information you carry in your shopping cart can be stored in two different ways:

  • In a cookie. This is how the store knows what you have in the car if you are not identified in it with user and password.
  • In a temporary record in database, linked to your user in the store, ie you must be identified.

If we want two online stores under different domains to share the same shopping cart, in the event that the information we have put in the car is stored in a cookie, the only way to do it is to generate two cookies with the same content, one for each domain. This requires that technically when you browse a store in some way you do it for both, and that when you modify the contents of your shopping cart, the order is executed in both to modify cookies simultaneously.

In the case that we are identified in the online store and that the information of the shopping cart is stored in the database, we find ourselves in the same situation described previously with the cookies but with the database, or share the database of users and cart of the purchase between several stores, so that it is from the ecommerce that is the information of the user and of its cart of the purchase is unique in a table of shared data.

In addition, it is necessary to take into account that if you make the checkout (the payment of the purchase) in any of the stores, you must be able to do it with products of the other store, something somewhat rare for the internal processes of an ecommerce application. So sharing a data table, or several between independent stores is not trivial, and any solution is technically heavy to implement.

The unique cart shared between shops with Woocommerce

By the way, online stores that use a common shopping cart? The most exponent I know is the Tradeinn group, whose 14 online stores share a single shopping cart.

As I said just before, one of the options is to share tables in the database between different stores. Here is the key, to share the same database for the two stores (or whatever). The easiest way to do this is to share the entire database, including the product database, although in a store there are some products and another store.

Sharing the database between two e-shops means that it is a single database for both stores, with a single ecommerce management application.

This implies that the layer of the user interface is the one that will be charged to show a content or another depending on the domain or store in which we find ourselves. Below actually will be running a single online store application, in this case Woocommerce on WordPress.

How to have multiple websites and a single installation of WordPress + Woocommerce

WordPress as almost any online content manager is responsible for managing internal redirects of Web pages to be able to use friendly links (URLs). This is a problem if we want to use the same database for two different domains because all references to files and the web itself are done through absolute links, i.e links that always include the domain name of the web. That makes it impossible to have a single installation and two different domains simultaneously.

To solve this great drawback we have Woocommerce (theme) (known as WordPress MU for its origin although for years is the same WP with a special configuration). This variant of WordPress allows to have a single installation for multiple independent webs. But we still have a great drawback to solve, and is that the database is shared but each website has its own tables for configuration and content itself, since they function as completely independent and autonomous websites. This implies that the tables in the database corresponding to Woocommerce are also multiplied and are characteristic of each of the Web sites on the network. This is the way Woocommerce (theme)provides web hosting service to any user.

How to have multiple domains with a single WordPress

The network of sites with WordPress can be configured in two ways. Each Web site can either be subdomains of a primary domain, or a directory of the primary domain (installed at the root of the domain). When we do an installation of WP MU is necessary to choose one or another option, we can not combine them.

For the case that we have the option to use directories is enough. Remember that you must have WP installed in the root of the domain that is.

To convert each of those Web sites from a folder to a separate domain, we need a plugin called WordPress MU domain Mapping that will take care of redirecting all calls to a specific domain to the corresponding website in WordPress.

With this plugin we can already glimpse the solution for two domains to use the same website, which is what it is for the two domains to use the same Woocommerce, and therefore both online stores share users and shopping cart (in addition to its position D and everything else).

Nothing prevents us from indicating in the configuration of the WP MU Domain Mapping plugin, that two domains are linked to the same Web site. That simple. In this way we will have two Web domains with exactly the same content, one replica of each other.

Show different content according to the domain

The last step is to personalize the templates of WordPress and Woocommerce (theme) so that depending on the domain that is visiting the user, show some content or others, some categories or others, some products or others, load one header or another, that the Internal search engine is restricted in each domain to what it belongs to, etc.

And do not forget the SEO, we must take care of what content we allow indexing for each domain and not duplicate them because we would penalize for Google. Also the meta headers, the Twitter Cards and the tracking codes like those of Google analytics must be customized for each domain.

We will do this simply by adding a meta of noindex in the header of the contents that can be displayed under a domain that does not belong to it. If we use XML Sitemaps to help Google index our content we must also take it into account to generate the XML map correctly and add in each domain the contents that correspond.

Difficulties to solve

One of the difficulties I thought would be to land all of the above is that each of the online stores should work under HTTPS security protocol. This implies that at the Web server level it is necessary to have an SSL security certificate for each domain (or spend a fortune on a multidomain certificate).

It turns out that our installation, as I have described so far, uses different domains in a virtualized way, but a single physical site, complicating the installation of an SSL certificate for each domain on the same physical site. I use server management panels to manage hostings, for convenience and because I do not like to get into the heavy task of configuring a web hosting by hand manipulating files of Apache or Nginx. Hostings management panels typically only allow you to install an SSL certificate over a domain with configured physical hosting. This has solution, in fact I use the free SSL certificates of Let’s encrypt, but I leave it for another time.

If I am sincere the heaviest can become the personalization of the theme to show some content or others. What I recommend is that if this is your case, do not even think to use the official theme of Woo, the Storefront, or none that is the son of this. Personalization requires three times the effort that.

Leave a Reply

Your email address will not be published. Required fields are marked *