Automattic\WooCommerce\Blocks\BlockTypes
AddToCartWithOptions::initialize()
Initializes the AddToCartWithOptions 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.
Метод класса: AddToCartWithOptions{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->initialize();
Код AddToCartWithOptions::initialize() AddToCartWithOptions::initialize WC 9.7.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 ); }