wc_empty_cart_message()
Show notice if cart is empty.
Хуки из функции
Возвращает
null. Ничего (null).
Использование
wc_empty_cart_message();
Список изменений
| С версии 3.1.0 | Введена. |
Код wc_empty_cart_message() wc empty cart message WC 10.5.0
function wc_empty_cart_message() {
$notice = wc_print_notice(
wp_kses_post(
/**
* Filter empty cart message text.
*
* @since 3.1.0
* @param string $message Default empty cart message.
* @return string
*/
apply_filters( 'wc_empty_cart_message', __( 'Your cart is currently empty.', 'woocommerce' ) )
),
'notice',
array(),
true
);
// This adds the cart-empty classname to the notice to preserve backwards compatibility (for styling purposes etc).
$notice = str_replace( 'class="woocommerce-info"', 'class="cart-empty woocommerce-info"', $notice );
// Return the notice within a consistent wrapper element. This is targeted by some scripts such as cart.js.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<div class="wc-empty-cart-message">' . $notice . '</div>';
}