Automattic\WooCommerce\Blocks
BlockTemplatesController::hide_template_selector_in_cart_checkout_pages
Prevents the pages that are assigned as Cart/Checkout from showing the "template" selector in the page-editor. We want to avoid this flow and point users towards the Site Editor instead.
Method of the class: BlockTemplatesController{}
No Hooks.
Returns
null
. Nothing (null).
Usage
$BlockTemplatesController = new BlockTemplatesController(); $BlockTemplatesController->hide_template_selector_in_cart_checkout_pages();
BlockTemplatesController::hide_template_selector_in_cart_checkout_pages() BlockTemplatesController::hide template selector in cart checkout pages code WC 9.9.5
public function hide_template_selector_in_cart_checkout_pages() { if ( ! is_admin() ) { return; } $current_screen = get_current_screen(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( $current_screen && 'page' === $current_screen->id && ! empty( $_GET['post'] ) && in_array( absint( $_GET['post'] ), array( wc_get_page_id( 'cart' ), wc_get_page_id( 'checkout' ) ), true ) ) { wp_add_inline_style( 'wc-blocks-editor-style', '.edit-post-post-template { display: none; }' ); } }