Last active
April 15, 2020 21:59
-
-
Save deivamagalhaes/1d7a0652cd72ec4f1026d53f1c24e0ba to your computer and use it in GitHub Desktop.
Allows to sort the packing list excluding a given category tree
This file contains hidden or 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 | |
add_filter( 'woocommerce_get_product_terms', function ( $terms, $product_id, $taxonomy, $args ) { | |
if ( isset( $_GET['wc_pip_action'] ) && ! empty( $_GET['wc_pip_document'] ) && 'packing-list' == $_GET['wc_pip_document'] ) { | |
$terms = wp_get_post_terms( $product_id, $taxonomy, array( | |
'orderby' => 'parent', | |
'order' => 'DESC', | |
'exclude_tree' => '33', | |
) ); | |
} | |
return $terms; | |
}, 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment