Last active
May 8, 2024 09:43
-
-
Save shameemreza/0f1c2baf2f7009ad12733efa34c992e5 to your computer and use it in GitHub Desktop.
Add Gutenberg Editor support to WooCommerce Classic Editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// enable gutenberg for woocommerce | |
function activate_gutenberg_product( $can_edit, $post_type ) { | |
if ( $post_type == 'product' ) { | |
$can_edit = true; | |
} | |
return $can_edit; | |
} | |
add_filter( 'use_block_editor_for_post_type', 'activate_gutenberg_product', 10, 2 ); | |
// enable taxonomy fields for woocommerce with gutenberg on | |
function enable_taxonomy_rest( $args ) { | |
$args['show_in_rest'] = true; | |
return $args; | |
} | |
add_filter( 'woocommerce_taxonomy_args_product_cat', 'enable_taxonomy_rest' ); | |
add_filter( 'woocommerce_taxonomy_args_product_tag', 'enable_taxonomy_rest' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment