Created
July 28, 2023 07:14
-
-
Save PluginRepublicSupport/88c28aed3ceb50907c5f26abb66c2e8b to your computer and use it in GitHub Desktop.
Hide child products' category if it's empty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*** Hide child product category if it's empty ***/ | |
add_filter( 'pewc_filter_item_start_list', function( $item, $group, $group_id, $post_id ) { | |
if ( $item['field_type'] == "product-categories" && empty( $item['child_products'] ) ) { | |
return false; | |
} | |
return $item; | |
}, 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment