1

I'm creating a plugin to create reports for a WC multisite installation.

I would like to be able to use the plugin in the master site admin and get orders for all sites within the multisite installation.

I don't see a way to do this in the wc_get_orders WC function or any other documented way. Is this possible using the WordPress or WooCommerce APIs?

1 Answer 1

3

The answer is to call the switch_to_blog($blog_id) function before calling any WooCommerce functions, then restore_current_blog() once done.

2
  • hi mark i would be really interested to see this plugin in action do you have an example Commented Dec 26, 2017 at 20:28
  • switch_to_blog() doesn't give you access to Woocommerce functions unless you have Woocommerce installed on the current site as well, FYI.
    – Nathan
    Commented Jul 30, 2019 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.