- 
                Notifications
    
You must be signed in to change notification settings  - Fork 10.7k
 
Closed
Description
Using the product_type_selector filter from wc_get_product_types() in a plugin during the 'plugins_loaded' action to remove a product type will result in breaking show_hide_panels javascript function in https://github.com/woothemes/woocommerce/blob/master/assets/js/admin/meta-boxes-product.js#L127
The javascript still needs to know all of the product types so that it can show hide correctly instead of the filtered product types.
This was changed in the following commit : b57030a
Reverting the change in the includes/admin/class-wc-admin-assets.php fixes the issue.
Code to reproduce has to be in a plugin:
function filter_product_types( $types ){ 
    return array(
        'simple'   => __( 'Simple product', 'woocommerce' ),
        'grouped'  => __( 'Grouped product', 'woocommerce' ),
        'variable' => __( 'Variable product', 'woocommerce' )
    );
} 
function plugin_init(){ 
    add_filter( 'product_type_selector',  'filter_product_types' ); 
}
add_action( 'plugins_loaded', 'plugin_init' ); 
Metadata
Metadata
Assignees
Labels
No labels