Automattic\WooCommerce\Blocks\BlockTypes
AddToCartWithOptions::add_to_cart_message_html_filter()
Filter the add to cart message to prevent the Notice from being displayed when the Add to Cart form is a descendent of a Single Product block and the Add to Cart button is clicked.
Метод класса: AddToCartWithOptions{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$AddToCartWithOptions = new AddToCartWithOptions(); $AddToCartWithOptions->add_to_cart_message_html_filter( $message );
- $message(строка) (обязательный)
- Message to be displayed when product is added to the cart.
Код AddToCartWithOptions::add_to_cart_message_html_filter() AddToCartWithOptions::add to cart message html filter WC 9.7.1
public function add_to_cart_message_html_filter( $message ) { // phpcs:ignore if ( isset( $_POST['is-descendent-of-single-product-block'] ) && 'true' === $_POST['is-descendent-of-single-product-block'] ) { return false; } return $message; }