I want to hide specific variations from being shown in the dropdown of woocommerce product pages. I was able to hide the "choose an option" but I am struggling with doing the same for the value="2,5 kg"
for example
This is my code for hiding "choose an option":
add_filter( 'woocommerce_dropdown_variation_attribute_options_html', 'remove_choose_an_option');
function remove_choose_an_option( $html ){
$html = str_replace('<option value="">' . __( 'Choose an option', 'woocommerce' ) . '</option>','',$html);
return $html;
}
But how to hide the variation with the value="2,5 kg"
for example?
example product: https://www.keimster.de/produkt/gekeimtes-gesundes-muesli/
I also tried with css but none of those 2 is working
#groesse > option[value=2,5 kg], #groesse > option:nth-child(1) {display: none;}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…