add_filter( 'woocommerce_shipping_free_shipping_is_available', 'free_shipping_for_x_cart_items', 10, 3 );
function free_shipping_for_x_cart_items( $is_available, $package, $shipping_method ) {
$item_count = WC()->cart->get_cart_contents_count();
if ( $item_count == 1 ) {
$notice = __("Добавете още един артикул от категория Стелки и вземете безплатна доставка");
$is_available = false;
} elseif ($item_count > 1) {
$notice = __("You get free shipping");
$is_available = true;
}
if ( isset($notice) ) {
wc_add_notice( $notice, 'notice' );
}
return $is_available;