Recently I was testing my new plugin related to a multisite network of WooCommerce stores and noticed that before doing a product import into one of the stores in a network you first need to do some additional network configuration.
I mean if you just go to a product import and try to upload a CSV file for example, you will definitely get an error like that:
Sometimes when you work with WordPress multisite network you may need to create a super administrator user not from the dashboard, but from the database with the help of SQL queries.
And in this tutorial I am about to show you how. There are actually only two steps we need to do:
When it comes to plugins installed on WordPress Multisite network, some of them can be activated either for the whole network or for a specific site of the network only.
Network activated plugin:
The same plugin is activated site-specific:
It shouldn’t be a problem to understand how it works, the problems could appear when we try to check whether a plugin is network or site-specifically activated in the code.
There are multiple ways to do that and each of them is quite different.
Recently I’ve developed a user syncronisation plugin which allows to share users between multiple WordPress websites and uses REST API. But when I tried to explore what similar plugins are already out there I found a couple of WordPress Multisite user sync plugins.
And in this moment I don’t fully get it what those plugins do, because users within a multisite network are already shared between blogs.
Let’s figure it out in this post.
I’ve been talking a lot about WordPress Multisite synchronisation throughout my blog. And also I have multiple plugins for that, for example – if you are looking for a way to sync WooCommerce products, you can check this plugin, only product inventory – this one.
And right now I would like to talk about WooCommerce orders, specifically about a scenario when you want all the order across your Multisite network to appear on a single store and (optionally) to be removed from the original store where this order has been made.
Every once in a while I am receiving questions about my Simple Multisite Crossposting plugin whether it works with shared media library plugins or not (yes – it works). And when I decided to test it I figured it out that there are multiple shared media library plugins out there and every one of them works a little bit differently.
The key idea of most of these plugins is to store all the media on one “main” blog and not necessarily it should be the blog with ID = 1. Then some of them use
switch_to_blog() function every time you’re working with attachments on subsites, the other ones even create attachments in database linked to original files on all subsites (I assume it could lead to issues by the way).
Most of all I like a
switch_to_blog() approach because it seems unharmful, you can even stop using network media library any time, just deactivate the plugin and continue to use your websites as usual.
In this tutorial I am going to show you two ways how you can sync your WooCommerce products between stores within a single WordPress multisite network.
Under two ways I mean this:
- In code with the help of the
woocommerce_update_productaction hook, the
switch_to_blog()function and CRUD layers (in case we’re working not with a multisite network but with standalone WooCommerce stores, then we need to use REST API, there is a separate tutorial about that).
- With the plugin (just install and here we go).
Below is an example of how it can be implemented on your store with my plugin: