In our previous article, about creating a Single Shopping Cart and Checkout for WooCommerce Multisite Stores, we introduced the need and advantages of having such a feature. But the idea of a global shopping cart, is rather a simplified perspective. In reality, we would have to achieve a lot more. This would be clear when we divide each requirement as a module, and take a deeper look at it.
The Login and Accounts Module
Here, we have to elaborate on the concept of a ‘Global Shopper’. A Global Shopper is a single user, who can access all shops. If the user signs into a single shop, he is signed into all shops. It is similar to how Google websites work. Say you’ve signed into Gmail. When you switch to YouTube or Google+, you’ll be logged in, to your account there as well.
When we look at a multisite network, only a Super Admin has the privilege, to be logged into all sites. A Super Admin is a user created at the network level, with the login capabilities (and many other capabilities). We will have to create a new user, with the login privileges, but restrict other capabilities. Every user account created, on any shop, would create a user with this role.
The user will be able to access and view all sites. Since the user will be a single user on all shops, the information, such as shipping and billing addresses will be shared. The WooCommerce Account page, will have to be maintained on the main site. The ‘My Account’ Page will show orders made across all sites.
The Search Interface
Every shop has a search option. The search lists products from the current shop. If you want to display products from all shops, the search functionality should be provided by the main site. The main site which stands above all the network sites, will have to provide a Global search option. The Global Search, will search across all sites and post results. Thus, the results page will be present on the main site. To purchase a particular product, the user will have to click on a product link which will redirect him to the shop, which is selling the product.
A plugin like Global Site Search, can be used to provide the search feature. We would need to ensure, that search happens only for products. We will also have to create a search results template, to display relevant information in the results.
The Global Cart
The Shopping cart for a user has to be the same across all stores. We cannot achieve this using the current WooCommerce cart. We will have to provide our own cart, which will be compatible with the WooCommerce. The cart will be present at the network level, that is to say, that there will be single cart across all sites in the multisite. It will behave the same way as the WooCommerce cart. The Cart Page will be present on the main site because information in the cart will be of products across various shops.
As simple as the functionality sounds, it involves intensive effort in its implementation. Apart from recreating the entire cart functionality, we have to ensure a secure solution. Since WooCommerce uses sessions to save cart, we will have to provide an alternative solution, by saving values as user meta or using cookies.
The Checkout Page
Finally, the cart and checkout page will be redirected to the main site. The products in the cart, will have to be grouped by each store. This is just to make it simple when coupons are involved. For coupons associated with a single store, can be applied on products belonging to that store. Store specific discounts and rewards can be accordingly handled as well.
At the time of purchase, customer information will be input only once. Orders will be sent to individual stores for further processing, as well as the entire order will be maintained on the main site.
When you think about it, there is quite a bit of effort involved. But the approach has to stem from a specific requirement. Because then it becomes clear to deduce a solution. The overview we have provided, might not necessarily meet your exact specifications. That is why we need feedback from you, to understand what is expected from a user’s perspective. Do be sure to leave your comments, in the comment section below.