• marketingeimpactkevin


    Hi Todd,

    I understand that this is a narrow use case, but we’re using the block editor on Woocommerce product posts, which can be enabled as simply as using the following code:
    add_filter('use_block_editor_for_post_type', '__return_true');

    Unfortunately, some functionality in the block editor breaks after comments/reviews are added to the post.

    Here’s a list of steps to reproduce:

    1. Install Woocommerce on a fresh install of WordPress.
    2. Add the above code to the active theme’s functions.php
    3. Create a product, confirm that no errors are registered in the browser console.
    4. Comment on the product in the front end, then return to the backend. The following error appears:
    Uncaught ReferenceError: commentsBox is not defined
        at HTMLDocument.<anonymous> (post.php?post=7&action=edit:589)
        at i (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,underscore,backbone,wp-util,&load[chunk_1]=wp-backbone,media-models,moxiejs,plupload&ver=5.3.2:2)
        at Object.fireWith [as resolveWith] (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,underscore,backbone,wp-util,&load[chunk_1]=wp-backbone,media-models,moxiejs,plupload&ver=5.3.2:2)
        at Function.ready (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,underscore,backbone,wp-util,&load[chunk_1]=wp-backbone,media-models,moxiejs,plupload&ver=5.3.2:2)
        at HTMLDocument.J (load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,underscore,backbone,wp-util,&load[chunk_1]=wp-backbone,media-models,moxiejs,plupload&ver=5.3.2:2)

    The result is that third-party plugins (such as Yoast and RankMath) break on these posts.

    As I said, I understand that this is a narrow use case, but with the block editor as the future of WordPress, our agency is embracing it, including on product posts. This is the only issue that we’ve experienced with it so far. It would be nice to get this fixed to make Woocommerce as “future proof” as possible.


Viewing 4 replies - 1 through 4 (of 4 total)
  • We have exactly the same problem. Third-party plugins indeed don’t work anymore for us (Woocommerce Bookings, Yoast, ACF).

    How did you work around it for now @marketingeimpactkevin?

    Thread Starter marketingeimpactkevin


    Thanks for helping to triage the issue @iggyvanlith

    We haven’t found a workaround, and it would be nice to have some attention given to this.

    In the meantime I found some workaround for now. It’s not ideal and I’m not sure yet if it’s ok for the workflow of my client. It remove the comments / reviews on the product-pages. If you don’t need those it does the trick.

    function wpdocs_remove_product_comments_field() {
      remove_post_type_support( 'product', 'comments' );
    add_action( 'admin_init', 'wpdocs_remove_product_comments_field' );

    Also somebody else created a workaround to use a parameter in the url to enable/disable gutenberg editor for products:

    • This reply was modified 3 years, 11 months ago by iggyvanlith.
    Thread Starter marketingeimpactkevin


    Unfortunately, these are both non-negotiable for us. We need rely heavily on both Gutenberg and product reviews. I suppose we could use the post editor just for editing the SEO metadata. Thanks for the link to the bug report on Woocommerce!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Comments Break Block Editor on Woocommerce Product Posts’ is closed to new replies.