WooCommerce add custom product type

Great guide here: https://www.ibenic.com/custom-woocommerce-product-type/

Following this tutorial will get you to a point where you will have a working custom product type, but it will be missing the Inventory tab in the back-end

To fix that, you will need to add the following JS to your admin_footer method you’ve already created following the tutorial:

<?php if ( $is_advanced ) { ?>
<?php } ?>

See more here: https://stackoverflow.com/questions/43109755/how-to-enable-price-and-inventory-for-custom-product-type-in-woocommerce

Also, after following the tutorial, chances are that your product will not save correctly. It will save as Simple product instead of your custom product type.

To fix that, you need to add a constructor to your custom product class, the one that extends WP_Product.

The constructor should contain the following:

public function __construct( $product ) {
  $this->product_type = 'advanced';
  parent::__construct( $product );


Leave a Reply