Archived topic
generate blocks woocommerce integration?
10 replies · Started by johnaps on March 21, 2020
Hello!
I am currently trying out generateblocks! Gudos on the release, always happy for your developments in any kind of plugin!
I just want to ask cause i have an ecommerce store (woocommerce)
Can i use it on product pages? Like lets say elementor lets you costumize the body of product pages just as you want...? is there a way to do this? It would be superawesome i think!!
Hi there,
not yet there isn't. Maybe something for the future ;)
Would be great! Maybe a workaround would be to make gutenberg take control of woocommerce product pages? Will look into it...
You can enable the Gutenberg editor on Single Products like so:
// WP 5.0 Woo 3.4.1 or later
// Edit Woo Product with Gutenberg
function db_enable_gutenberg_single_product($editable, $post_type) {
if($post_type == 'product'){
$editable = true;
}
return $editable;
}
add_filter('use_block_editor_for_post_type', 'db_enable_gutenberg_single_product', 10, 2);
But this will only allow you to edit the Short Description.
I would expect Woo has full product editing in its future scope.
Found this and i am trying it out, leaving it here for other fellow happy generatepressors!~ (looks complete at first glance...)
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);
Thanks for sharing :)
Hi Johnnaps,
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.
Do you have the similar problem and any solution have you tried to make the "product category" and "product tag" appear?
Notes: Im able to configure out the Rankmath, Reviews, and other fields. But only unable to configure the “Product Category” & “Product Tag”
Thanks
I think you can edit them from quick edit on "all products"
Hi johnaps,
Thanks for your response. I appreciate it very much.
TQ and have a nice day
Regards,
Melvin
I experienced a bug where the classic editor was still loading instead and wanted to share an updated solution:
• Changed add_filter $priority from default (10) to a value of 20
• Added taxonomy for WooCommerce category and tags
// Enable Gutenberg Blocks in Product Descriptions
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', 20, 2 );
// Show taxonomy for woocommerce category and tags
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' );
Thanks for sharing!