Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions user-switching.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function init_hooks(): void {
add_action( 'bbp_template_after_user_details_menu_items', [ $this, 'action_bbpress_button' ] );

// WooCommerce integration:
add_action( 'before_woocommerce_init', [ $this, 'action_before_woocommerce_init' ] );
add_action( 'woocommerce_login_form_start', [ $this, 'action_woocommerce_login_form_start' ], 10, 0 );
add_action( 'woocommerce_admin_order_data_after_order_details', [ $this, 'action_woocommerce_order_details' ], 1 );
add_filter( 'woocommerce_account_menu_items', [ $this, 'filter_woocommerce_account_menu_items' ], 999 );
Expand Down Expand Up @@ -1240,6 +1241,16 @@ public function action_enqueue_command_palette_script(): void {
);
}

/**
* Declares compatibility with WooCommerce HPOS and cart/checkout blocks features.
*/
public function action_before_woocommerce_init(): void {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
}
}

/**
* Adds a 'Switch back to {user}' link to the WooCommerce login screen.
*/
Expand Down