0
X
Add Snippet To Project
New Project
Add To Existing Project
<?php
add_filter( 'product_type_options', function( $options ) {
// Remove "Virtual" checkbox
if ( isset( $options['virtual'] ) ) {
unset( $options['virtual'] );
}
// Remove "Downloadable" checkbox
if ( isset( $options['downloadable'] ) ) {
unset( $options['downloadable'] );
}
// Remove "Service" checkbox
if ( isset( $options['service'] ) ) {
unset( $options['service'] );
}
// Remove "Used Good" checkbox
if ( isset( $options['used_good'] ) ) {
unset( $options['used_good'] );
}
// Remove "Defective Copy" checkbox
if ( isset( $options['defective_copy'] ) ) {
unset( $options['defective_copy'] );
}
// Remove "Differential Taxation" checkbox
if ( isset( $options['differential_taxation'] ) ) {
unset( $options['differential_taxation'] );
}
// Remove "Food" checkbox
if ( isset( $options['is_food'] ) ) {
unset( $options['is_food'] );
}
// Unset status, pricing, inventory fields for variation options
if ( isset( $options['variation_options'] ) && is_array( $options['variation_options'] ) ) {
$variation_options = &$options['variation_options'];
unset( $variation_options['status'] );
unset( $variation_options['pricing'] );
unset( $variation_options['inventory'] );
}
// Remove all lines from the dropdown menu except the top 3 lines
if ( isset( $options['dropdown_menu'] ) && is_array( $options['dropdown_menu'] ) ) {
$dropdown_menu = &$options['dropdown_menu'];
if ( count( $dropdown_menu ) > 3 ) {
$dropdown_menu = array_slice( $dropdown_menu, 0, 3 );
}
}
return $options;
} );
