add_action( 'woocommerce_cart_calculate_fees', 'wpp_custom_surcharge' );
function wpp_custom_surcharge() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
return;
}
$percentage = 0.15;
$time = date( 'H' );
if ( 11 <= (int) $time && 12 > (int) $time ) :
$surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total ) * $percentage;
$woocommerce->cart->add_fee( 'Счастливый час', - $surcharge, true, '' );
endif;
}