Automattic\WooCommerce\Blocks\BlockTypes

Checkout::initialize()protectedWC 1.0

Initialize this block type.

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

Метод класса: Checkout{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->initialize();

Код Checkout::initialize() 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 );
}