Site logo

[Resolved] Disable woocommerce blocks

Home Forums Support [Resolved] Disable woocommerce blocks

Home Forums Support Disable woocommerce blocks

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1728591
    roadlink

    Hello,

    I use GPP and GB free for now.
    I wonder if I can remove this CSS.
    /wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/style.css

    I plan to use below code, Is it safe or do you have better idea?

    function disable_woocommerce_block_editor_styles() {
      wp_deregister_style( 'wc-block-editor' );
      wp_deregister_style( 'wc-block-style' );
    }
    add_action( 'enqueue_block_assets', 'disable_woocommerce_block_editor_styles', 1, 1 );
    function slug_disable_woocommerce_block_styles() {
      wp_dequeue_style( 'wc-block-style' );
    }
    add_action( 'wp_enqueue_scripts', 'slug_disable_woocommerce_block_styles' );
    #1729047
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I would only add the second function. The first one removes those assets from the editor as well, which could cause some display issues possibly (maybe not).

    Just be sure to remember you’ve removed these stylesheets in case you decide to use their blocks at some point 🙂

    #1729202
    roadlink

    Thanks Tom.
    It seems so far so good.
    That file is 166Kb which is huge.

    #1730043
    Tom
    Lead Developer
    Lead Developer

    No problem. Definitely pretty silly – hopefully they make it only enqueue when needed in the future.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.