New
// 1. Checkbox "Toon alleen beschikbare producten" boven de winkelpagina add_action('woocommerce_before_shop_loop', 'mgm_add_stock_filter_checkbox', 20); function mgm_add_stock_filter_checkbox() { if (!is_shop() && !is_product_category() && !is_product_taxonomy()) return; ?>
get('meta_query'); $meta_query[] = array( 'key' => '_stock_status', 'value' => 'instock', 'compare' => '=' ); $query->set('meta_query', $meta_query); } } // 3. Toon "SOLD" label i.p.v. prijs als product is uitverkocht (overal) add_filter('woocommerce_get_price_html', 'mgm_replace_price_with_sold', 20, 2); function mgm_replace_price_with_sold($price, $product) { if (!$product->is_in_stock()) { return 'SOLD'; } return $price; } // 4. Verberg beschikbaarheidstekst ("Niet op voorraad") op productpagina add_filter('woocommerce_get_availability_text', 'mgm_hide_availability_text', 20, 2); function mgm_hide_availability_text($availability, $product) { if (!$product->is_in_stock()) { return ''; // leeg maken } return $availability; }