Created
May 13, 2019 06:59
-
-
Save wickywills/4c676e24493402c6098f99a4cf8e48ae to your computer and use it in GitHub Desktop.
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
``` | |
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'my_wc_filter_dropdown_args', 10 ); | |
function my_wc_filter_dropdown_args( $args ) { | |
$product_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $product->id; | |
if( has_term( array('clothing','traningsklader'), 'product_cat', $product_id ) ){ | |
$variation_tax = get_taxonomy( 'attribute' ); | |
$args['show_option_none'] = 'Choose ' . strtolower(wc_attribute_label($args['attribute'],$product)); | |
} | |
return $args; | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment