Archived topic
Disable woocommerce blocks
3 replies · Started by roadlink on April 10, 2021
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' );
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 :)
Thanks Tom.
It seems so far so good.
That file is 166Kb which is huge.
No problem. Definitely pretty silly - hopefully they make it only enqueue when needed in the future.