Automattic\WooCommerce\Blocks\BlockTypes
AddToCartForm::initialize()
Initializes the AddToCartForm block and hooks into the wc_add_to_cart_message_html to prevent displaying the Cart Notice when the block is inside the Single Product block and the Add to Cart button is clicked.
It also hooks into the woocommerce_add_to_cart_redirect to prevent redirecting to another page when the block is inside the Single Product block and the Add to Cart button is clicked.
Метод класса: AddToCartForm{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->initialize();
Код AddToCartForm::initialize() AddToCartForm::initialize WC 9.5.1
protected function initialize() { parent::initialize(); add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message_html_filter' ), 10, 2 ); add_filter( 'woocommerce_add_to_cart_redirect', array( $this, 'add_to_cart_redirect_filter' ), 10, 1 ); }