In WooCommerce 3.4.1, the Gutenberg for products has been disabled. Here is a code if you want to activate it.
function wplook_activate_gutenberg_products($can_edit, $post_type){
if($post_type == 'product'){
$can_edit = true;
}
return $can_edit;
}
add_filter('gutenberg_can_edit_post_type', 'wplook_activate_gutenberg_products', 10, 2);
Use the following code if you work with WordPress 5.0
function wplook_activate_gutenberg_products($can_edit, $post_type){
if($post_type == 'product'){
$can_edit = true;
}
return $can_edit;
}
add_filter('use_block_editor_for_post_type', 'wplook_activate_gutenberg_products', 10, 2);
If you are a non-technical user, our support team can do this small job for you. The only thing you have to do is order a small job, and we will provide the service in less than 24 hours.
Gutenberg, WooCommerce
Hi guys, i dropped this into a functions.php editor plugin I have where i modify my functions file. Is that the right place because I don’t see any changes yet?
Yes, it’s the right place!
Hi guys, this snippet enabled Gutenberg for me, however there is missing Select category for the Product in the sidebar, or anywhere in the editor…
Hey Thommy,
You can go to Products > View all > and quick edit. This will allow you to select the category.
or add the next code to functions.php
function wplook_activate_gutenberg_products_cat( $args, $taxonomy_name ) {
if ( ‘product_cat’ === $taxonomy_name ) {
$args[‘show_in_rest’] = true;
}
return $args;
}
add_filter( ‘register_taxonomy_args’, ‘wplook_activate_gutenberg_products_cat’, 10, 2 );
Hi guys,
I’m running WordPress 5.1.1 and I’ve added the code above marked for WordPress 5.0 but I don’t see any difference when I view a product post in the admin side. I’ve put some debug in the code and it is successfully running the line “$can_edit = true;”
Do I need to do anything different for WordPress 5.1.1?
Hey All,
Found an issue with enabling Gutenberg into WC product field. I just installed this and was looking forward to using, but I have the new WC dashboard plugin installed and the WC dashboard header covers the Gutenberg topbar.
Any thoughts on how to fix? Thanks.
Hi
the code work fine and thanks for your help.
But in woocommerce 3.7.1 and wordpress 5.3 , the product info tab not open when ckick on.
Thank you it worked for me! But the woocommerce product categories and tags went gone after enable this, any idea how to get it back?
Hello. Thanks for this code, which indeed allowed me to have the Gutenberg editor to edit Woocommerce products! By account I don’t have the possibility to choose the category, no option related to categories is not available when Gutenberg is active (on posts and pages no worries though). Is this normal ? I know that for the moment Woocommerce doesn’t officially support GUtenberg 🙁
Amazingly useful! Thank you very much.
This works great BUT…
Categories and Tags disappear from the side menu. under Settings -> Document. (I can still get to Categories and Tags if I use Quick Edit but this way you can’t set the primary category if product is in more than one category.)
For now, I’m commenting out the add_filter line when I need to toggle between the Gutenberg editor and the old editor, so I can edit the Categories and Tags.
One problem. Adding that code strips category choice in product edit page… any fix for that?
Hi,
I’ve enabled gutenberg in Product by using the code below
`function wplook_activate_gutenberg_products($can_edit, $post_type){
if($post_type == ‘product’){
$can_edit = true;
}
return $can_edit;
}
add_filter(‘use_block_editor_for_post_type’, ‘wplook_activate_gutenberg_products’, 10, 2);`
Everything work well except the “Product Category” & “Product Tag” are missing at the at the product back end for editorial.
https :// imgur.com/ a/ zDLDOJW
Can you please advise how do I configure it so that “Product Category” & “Product Tag” appeared after i enabled the gutenberg?
Notes: Im able to configure out the Rankmath, Reviews, and other fields. But only unable to configure the “Product Category” & “Product Tag”
Thanks
I know this only does it to the description. Is there a way to also do this for the product short description?
For the people trying to enable categories on gutemberg, the above code does work, but has problems on the “.
So here it is corrected:
function wplook_activate_gutenberg_products_cat( $args, $taxonomy_name ) {
if ( ‘product_cat’ === $taxonomy_name ) {
$args[‘show_in_rest’] = true;
}
return $args;
}
add_filter( ‘register_taxonomy_args’, ‘wplook_activate_gutenberg_products_cat’, 10, 2 );
If you want to enable both categories and tags, use this code:
function wplook_activate_gutenberg_products_cat( $args, $taxonomy_name ) {
if ( ‘product_tag’ === $taxonomy_name || ‘product_cat’ === $taxonomy_name) {
$args[‘show_in_rest’] = true;
}
return $args;
}
add_filter( ‘register_taxonomy_args’, ‘wplook_activate_gutenberg_products_cat’, 10, 2 );
Worked GREAT, thank you a ton!
Works great indeed! Thanks a lot!
It was working only inside the theme functions.php but to make it work from a plugin you can change the priority to 20 for example.
Here:
function wplook_activate_gutenberg_products($can_edit, $post_type){
if($post_type == ‘product’){
$can_edit = true;
}
return $can_edit;
}
add_filter(‘use_block_editor_for_post_type’, ‘wplook_activate_gutenberg_products’, 20, 2);
function wplook_activate_gutenberg_products_cat( $args, $taxonomy_name ) {
if ( ‘product_tag’ === $taxonomy_name || ‘product_cat’ === $taxonomy_name) {
$args[‘show_in_rest’] = true;
}
return $args;
}
add_filter( ‘register_taxonomy_args’, ‘wplook_activate_gutenberg_products_cat’, 20, 2 );
Hello. I just tried this method out. it SEEMS to work great. However I noticed after it is enabled no changes made inside the product meta box will actually save when updating the page. For example if you go and change the product sku and hit update it acts like the page saves via ajax, but if you actually refresh the page you will see the updates didn’t save. Regular content however updates fine. Any ideas there?
Tested with bone stock woocommerce and 2021 theme.
Is it possible to enable Gutenberg on WooComerce product categories the same way?
Hello, this code doesn’t seem to work any more?