Comments Break Block Editor on Woocommerce Product Posts
-
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:
- Install Woocommerce on a fresh install of WordPress.
- Add the above code to the active theme’s functions.php
- Create a product, confirm that no errors are registered in the browser console.
- Comment on the product in the front end, then return to the backend. The following error appears:
post.php?post=7&action=edit:589 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.
Thanks
- The topic ‘Comments Break Block Editor on Woocommerce Product Posts’ is closed to new replies.