• Resolved dmitriamartin

    (@dmitriamartin)


    How do i removed the following from non-woo pages:

    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link  as="script" rel="prefetch">
    <link rel="stylesheet" id="wc-blocks-checkout-style-css"  media="all">
    <link rel="stylesheet" id="aws-style-css"  media="all">
    <script id="WCPAY_ASSETS-js-extra">var wcpayAssets = {"url":"https:\/\/rusticwatersrealty.com\/wp-content\/plugins\/woocommerce-payments\/dist\/"};</script>

    I’m already running this php snippet:

    function disable_woocommerce_loading_css_js() {
        if (function_exists('is_woocommerce')) {
            if (!is_woocommerce() && !is_cart() && !is_checkout()) {
                wp_dequeue_style('woocommerce-general');
                wp_dequeue_style('woocommerce-layout');
                wp_dequeue_style('woocommerce-smallscreen');
    			wp_dequeue_style('woocommerce_frontend_styles');
                wp_dequeue_style('woocommerce_fancybox_styles');
                wp_dequeue_style('woocommerce_chosen_styles');
                wp_dequeue_style('woocommerce_prettyPhoto_css');
    			wp_dequeue_style('woocommerce-inline');
    			wp_dequeue_style('wc-block-style');
    			wp_dequeue_style('wc-block-vendors-style');
    			wp_dequeue_script('woocommerce');
    			wp_dequeue_script('wc-cart');
    			wp_dequeue_script('wc-checkout');
    			wp_dequeue_script('wc-single-product');
                wp_dequeue_script('wc-cart-fragments');
    			wp_dequeue_script('wc-credit-card-form');
    			wp_dequeue_script('wc-chosen');
                wp_dequeue_script('wc-add-to-cart');
                wp_dequeue_script('wc-add-to-cart-variation');
                wp_dequeue_script('wc-country-select');
    			wp_dequeue_script('wc-address-i18n');
    			wp_dequeue_script('wc-order-tracking');
                wp_dequeue_script('wc_price_slider');
    			wp_dequeue_script('wc-quantity-increment');
                wp_dequeue_script('prettyPhoto');
                wp_dequeue_script('prettyPhoto-init');
                wp_dequeue_script('jquery-blockui');
                wp_dequeue_script('jquery-placeholder');
                wp_dequeue_script('fancybox');
                wp_dequeue_script('jqueryui');
    			wp_dequeue_script('woocommerce-cart-frontend');
            }
        }
    }
    add_action('wp_enqueue_scripts', 'disable_woocommerce_loading_css_js', 99);

    But the tags I shared still appear where they are not needed.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    The scripts linked in your first code block all refer to the Gutenberg block checkout method. Those aren’t really removable without breaking checkout.

    Conversely, the second code block refers to multiple different scripts used across a multitude of page but doesn’t include any from the block cart/checkout experience.

    While we don’t have direct access to your site to confirm, I’d recommend switching to the classic checkout mode as a way to prevent the block-based checkout scripts to be loaded.

    With that being said, can you elaborate a bit more on why you’re looking to remove those scripts? Is this linked to a deeper issue of a slow-loading site perhaps?

    Thread Starter dmitriamartin

    (@dmitriamartin)

    Nevermind. I’ve decided to move the woocommerce shop to it’s own domain which won’t have non-woocommerce pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to remove more Woo bloat’ is closed to new replies.