user3887452
user3887452

Reputation: 3

Is that possible to show multisite main site products into child sites?

I want to create a multisite project in which main site can create woocommerce project and also when we add products on main site. It will show in child sites also. I tried that doing but it wouldn't show. Is that possible in wordpress?

Upvotes: 0

Views: 265

Answers (1)

MEDZ
MEDZ

Reputation: 2295

Yes, you can switch to the main site and query whatever you want and then restore. In your child site theme, you do the following:

$main_site_id = 1; //use your main site id
switch_to_blog( $main_site_id );
//write any code as if you are in your main website
restore_current_blog();
//use the data you fetched in your current child site.

Note: If you will write woocommerce related code. Make your that you install woocommerce plugin in your child site.

Upvotes: 1

Related Questions