Check if WooCommerce is active
Most woocommerce plugins do not need to run unless woocommerce is already active. You can wrap your plugin in a check to see if woocommerce is installed:
// test to see if woocommerce is active (including network activated). $plugin_path = trailingslashit( wp_plugin_dir ). 'woocommerce/woocommerce. Php';
if (
in_array( $plugin_path, wp_get_active_and_valid_plugins() )
|| in_array( $plugin_path, wp_get_active_network_plugins() )
// custom code here.
Woocommerce is active, however it has not
// necessarily initialized (when that is
important
, consider
// using the `woocommerce_init` action). Note that this check will fail if the wc plugin folder is named anything other than woocommerce. Avoid creating custom database tables.
Custom Database Tables & Data Storage
Hello everyone, since last year, we have been working on building and rolling out hpos (high-performance
order
storage) as an opt-in feature. This changes the way that we store the order data ...