Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wickywills/4c676e24493402c6098f99a4cf8e48ae to your computer and use it in GitHub Desktop.
Save wickywills/4c676e24493402c6098f99a4cf8e48ae to your computer and use it in GitHub Desktop.
```
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