Viewing 10 replies - 1 through 10 (of 10 total)
  • I too am experiencing this.

    I have enabled the Gutenberg editor for WooCommerce products using the below code.

    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);

    I am now unable to remove these blocks.

    This update has also broken my custom content-single-product.php

    I also have the below code to add WooCommerce categories to the body class, which is now throwing an error.

    add_filter('body_class', 'wc_cat_names');
    function wc_cat_names($classes)
    {
    	if (is_product()) {
    		global $post;
    		$terms = get_the_terms($post->ID, 'product_cat');
    		foreach ($terms as $term) {
    			$classes[] = $term->slug;
    		}
    	}
    	return $classes;
    }

    Warning: Invalid argument supplied for foreach() in /Users/EXAMPLE/Development/local/wp-content/themes/EXAMPLE/inc/woocommerce.php on line 287

    Plugin Contributor Leif Singer

    (@leifsinger)

    Hello, thanks for reporting this. We added a template to the “product” post type, which might be interfering with your customization. The template can be removed using a filter like this:

    add_filter('woocommerce_register_post_type_product', function( $args ) {
        unset( $args['template'] );
        return $args;
    });

    Note however that this template also exists in WooCommerce 7.6.1, so if things worked fine in that version there might be another root cause for the behavior you’re seeing.

    Hello

    You can find a solution here :

    https://wordpress.org/support/topic/site-doesnt-include-support-for-the-woocommerce-product-tab-block/ (see Cameron answer)

    
    function reset_product_template( $post_type_args ) {
    	if ( array_key_exists( 'template', $post_type_args ) ) {
    		unset( $post_type_args['template'] );
    	}
    
    	return $post_type_args;
    }
    add_filter( 'woocommerce_register_post_type_product', 'reset_product_template' );

    I hope this solution will be stable, the next updates are freaking me out a bit.

    Question: is it Woocommerce’s will to prevent us from using Gutunberg which has become a WordPress standard? Incomprehensible not being able to activate Gutunberg properly in 2023 in Woocommerce!

    If we have to pay for an option to activate Gutunberg let us know.

    I don’t dare activate it for my next clients (fortunately I’m testing it on my own site). At some point the old editor just isn’t enough. My clients also take paid Woocommerce options… I need to trust the solution I’m selling.

    • This reply was modified 1 year, 4 months ago by Kuroweb.
    Thread Starter tamasfelix

    (@tamasfelix)

    Thanks for update, my website is on https://batoaneproteice.ro/

    everything works perfectly

    Plugin Contributor Leif Singer

    (@leifsinger)

    Question: is it Woocommerce’s will to prevent us from using Gutunberg which has become a WordPress standard? Incomprehensible not being able to activate Gutunberg properly in 2023 in Woocommerce! 

    To the contrary. This is part of WooCommerce’s efforts to provide native Gutenberg / blocks support for product management, and as we’ve seen here customizations like yours can clash with it.

    Once the new product management experience has shipped, those customizations should not be necessary anymore and should be removed — please only consider them a temporary bridge.

    Hi, I’ve just updated woocommerce new version 7.7.0 and now I’m unable to add description on my product. Not getting paragraph tab like i was using before. Not able to add anything under “Product name”

    Please help I’m not a tech savvy…

    https://imgur.com/a/bCwt7aP

    Hi,

    Please guide where to put this code, if it solves my problem.

    add_filter('woocommerce_register_post_type_product', function( $args ) {
        unset( $args['template'] );
        return $args;
    });

    Hi @thecoursepedia

    Thanks for reaching out!

    You can add the code using the Code Snippets plugin or create a child theme and add the PHP snippet to the functions.php file within the child theme.

    Hope this helps!

    Hello Leif Singer your snippet works. We have already migrated many products to Gutenberg editor. I hope that the Gutenberg editor master update doesn’t destroy my product descriptions!!!!!

    to add, you can also remove template lock – so it will add the template for new products, but won’t lock it, and won’t lock existing products:

    function woo_product_gutenberg_template_remove_lock( $args ) {
    	$args['template_lock'] = false;
    	return $args;
    }
    
    add_filter( 'woocommerce_register_post_type_product', 'woo_product_gutenberg_template_remove_lock' );
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Woocommerce product tab locked Version 7.7.0’ is closed to new replies.