-
-
Save tanmay27vats/89f9d67db78c33a6ffa1d844235a5db1 to your computer and use it in GitHub Desktop.
add_filter( 'product_type_selector', 'remove_product_types' ); | |
function remove_product_types( $types ){ | |
unset( $types['grouped'] ); | |
unset( $types['external'] ); | |
unset( $types['variable'] ); | |
return $types; | |
} |
The snippet is working woocommerce 3.4.4
Works on WooCommerce 3.4.5 too - thanks!
Works on WooCommerce 3.5.1
Thanks !
Works on WooCommerce 3.8.1.
Still working on Woocommerce 3.9.2 BUT comes with a "*Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'remove_product_types' not found or invalid function name in /wp-includes/class-wp-hook.php on line 288"
Looking exactly for this filter! Thanks!
Hi, I used the code snippets plugin to do this but it did not work on my side. Could you please help?
add_filter('product_type_selector', 'custom_product_type_selector');
function custom_product_type_selector($types) {
// Keep only 'simple' and 'variable' product types
$allowed_types = array(
'simple' => $types['simple'],
);
return $allowed_types;
}
not working sir