Automattic\WooCommerce\Blocks\BlockTypes

Checkout::initialize()protectedWC 1.0

Initialize this block type.

  • Hook into WP lifecycle.
  • Register the block with WordPress.

Method of the class: Checkout{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->initialize();

Checkout::initialize() code WC 9.4.2

protected function initialize() {
	parent::initialize();
	add_action( 'wp_loaded', array( $this, 'register_patterns' ) );
	// This prevents the page redirecting when the cart is empty. This is so the editor still loads the page preview.
	add_filter(
		'woocommerce_checkout_redirect_empty_cart',
		function ( $redirect_empty_cart ) {
			// phpcs:ignore WordPress.Security.NonceVerification.Recommended
			return isset( $_GET['_wp-find-template'] ) ? false : $redirect_empty_cart;
		}
	);

	add_action( 'save_post', array( $this, 'update_local_pickup_title' ), 10, 2 );
}