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.
Method of the class: AddToCartForm{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->initialize();
AddToCartForm::initialize() AddToCartForm::initialize code WC 9.4.2
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 ); }