Automattic\WooCommerce\Blocks\BlockTypes
Checkout::initialize
Initialize this block type.
- Hook into WP lifecycle.
- Register the block with WordPress.
Метод класса: Checkout{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->initialize();
Код Checkout::initialize() Checkout::initialize WC 10.4.0
protected function initialize() {
parent::initialize();
add_action( 'rest_api_init', array( $this, 'register_settings' ) );
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 );
}