Woocommerce-admin: If block editor is enabled for products, update and publish buttons become unavailable

Created on 12 Jul 2019  路  4Comments  路  Source: woocommerce/woocommerce-admin

Describe the bug
If block editor is enabled for products, update and publish buttons become unavailable for editing products.

Tickets affected
2167450-zen

To Reproduce
Steps to reproduce the behavior:

  1. Add the below snippet to your site
  2. Enable WC Admin
  3. Create or view a product in admin
  4. Buttons to update/publish are not available
function wplook_activate_gutenberg_products( $can_edit, $post_type ){
    if( 'product' === $post_type ){
        $can_edit = true;
    }

    return $can_edit;
}
add_filter( 'use_block_editor_for_post_type', 'wplook_activate_gutenberg_products', 10, 2 );

Screenshots
With wc-admin:

Image Link: https://cld.wthms.co/Z2wNGt

Without:

Image Link: https://cld.wthms.co/b9Yqq2

task

Most helpful comment

@jessepearson I have a fix in progress that will probably go out in our next release, but here is a code snippet to disable the navigation header when using the block editor:

function wc_admin_maybe_disable_nav( $is_connected_page, $current_page ){
    $current_screen = get_current_screen();
    if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
        $is_connected_page = false;
    }

    return $is_connected_page;
}
add_filter( 'woocommerce_page_is_connected_page', 'wc_admin_maybe_disable_nav', 10, 2 );

All 4 comments

Thanks for the bug report @jessepearson - I'm thinking we should not display the nav bar / activity panels if the block editor is enabled for products. But /cc @jameskoster for your thoughts.

Forgot to note the ticket, 2167450-zen , and I believe their theme may be enabling the block editor.

Yeah let's hide our App Bar on this screen for now.

@jessepearson I have a fix in progress that will probably go out in our next release, but here is a code snippet to disable the navigation header when using the block editor:

function wc_admin_maybe_disable_nav( $is_connected_page, $current_page ){
    $current_screen = get_current_screen();
    if ( method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() ) {
        $is_connected_page = false;
    }

    return $is_connected_page;
}
add_filter( 'woocommerce_page_is_connected_page', 'wc_admin_maybe_disable_nav', 10, 2 );
Was this page helpful?
0 / 5 - 0 ratings