Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderkevin/50eed1e4923428e51ece4fcfd45d0107 to your computer and use it in GitHub Desktop.
Save coderkevin/50eed1e4923428e51ece4fcfd45d0107 to your computer and use it in GitHub Desktop.
WooCommerce Data Store Demo - Product Inventory - Plugin hook
class WC_Product_Inventory_Data_Store_Plugin {
public function __construct() {
add_filter( 'woocommerce_data_stores', array( $this, 'install_data_store' ) );
}
public function install_data_store( $stores ) {
include_once dirname( __FILE__ ) . '/class-product-inventory-data-store.php';
$instance = new WC_Product_Inventory_Data_Store( $stores[ 'product' ] );
$stores[ 'product' ] = $instance;
return $stores;
}
}
new WC_Product_Inventory_Data_Store_Plugin();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment