• Resolved loopforever

    (@loopforever)


    Hello,
    I’m doing optimization work with Google Pagespeed.

    I’m getting
    …wp-content/plugins/woocommerce/assets/css/woocommerce.css
    “unused CSS” and “Eliminate render-blocking resources”.
    warning for Woocommerce.

    Is there a way to remove this css file for homepage?
    What can I do for solution?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey @loopforever,

    Is there a way to remove this css file for homepage?
    What can I do for solution?

    I understand you’re looking to optimize your website and have noticed the WooCommerce CSS file being reported by Google Pagespeed.

    The CSS files used by WooCommerce, and other plugins, are all loaded programmatically by WordPress. You may be able to find a plugin to prevent specific files from loading on certain pages, however, this is not best practice if they are not large files.

    I recommend you look into finding an optimization plugin for your website that will combine, minify, and importantly defer loading of files. This will do a lot of the optimization for you and lead to improved scores on Google Pagespeed.

    There are also several articles online relating to speeding up your WordPress site that you may be interested in: https://www.wpbeginner.com/wordpress-performance-speed/

    I hope that helps!

    Kind regards,

    Thread Starter loopforever

    (@loopforever)

    I think you misunderstood me. Yes, I made these optimizations. I want to disable this CSS file (woocommerce.css) “for Homepage only” as in below code. Because this file is not used on the Homepage. This is a “large” file. The cache plugin just shrinks/compresses. This file should not work on the Homepage.

    For example, I disabled the CSS styles of the blocks with the code below. Of course, this is not for the Homepage.

    add_action( 'wp_enqueue_scripts', ' slug_disable_woocommerce_block_styles' );
    // Disable WooCommerce front-end styles
    function slug_disable_woocommerce_block_styles() {
      wp_dequeue_style( 'wc-blocks-style' );
    }
    • This reply was modified 3 years, 2 months ago by loopforever.

    Hi there,

    Thanks for clarifying your use case here. You can disable WooCommerce stylesheets using filters as shown here.

    You could also use Conditional Tags to specify which pages stylesheets are applied to.

    I recommend checking out our Customizations Portal for any advanced customization support, as needed.

    Thread Starter loopforever

    (@loopforever)

    Okay. Thank you.

    Mirko P.

    (@rainfallnixfig)

    Great! Glad to hear we’ve been able to help you.

    As this thread is closed you can open a new topic if you have any further questions.

    Have a nice day!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Google PageSpeed for Woocommerce’ is closed to new replies.