• Resolved rorytatem

    (@rorytatem)


    I don’t use blocks – it doesn’t matter why.

    I disable everything blocks related. I have spent weeks of my life tweaking the output of WC because it outputs absolute garbage css.

    Updating WC to the latest version today I noticed even more Blocks related CSS, both css files and inline styles.

    I have tried to disable these as well with no luck, nothing is working.

    Please for the love of god fix this.

    Please for the love of god, just add a checkbox somewhere in the settings “Disable Blocks” – that doesn’t output a single blocks related piece of code.

    Literally millions of people would throw a party in the street.

    The new code in question – and i’m not using ANY OF THIS on my website:

    <link rel='stylesheet' id='woocommerce-add-to-cart-form-style-css' href='https://live.local/wp-content/plugins/woocommerce/assets/client/blocks/woocommerce/add-to-cart-form-style.css' media='all'>
    <style id='woocommerce-product-button-style-inline-css'>
    .wp-block-button.wc-block-components-product-button{align-items:center;display:flex;flex-direction:column;gap:12px;justify-content:center;white-space:normal;word-break:break-word}.wp-block-button.wc-block-components-product-button.is-style-outline .wp-block-button__link{border:2px solid}.wp-block-button.wc-block-components-product-button.is-style-outline .wp-block-button__link:not(.has-text-color){color:currentColor}.wp-block-button.wc-block-components-product-button.is-style-outline .wp-block-button__link:not(.has-background){background-color:transparent;background-image:none}.wp-block-button.wc-block-components-product-button.has-custom-width .wp-block-button__link{box-sizing:border-box}.wp-block-button.wc-block-components-product-button.wp-block-button__width-25 .wp-block-button__link{width:25%}.wp-block-button.wc-block-components-product-button.wp-block-button__width-50 .wp-block-button__link{width:50%}.wp-block-button.wc-block-components-product-button.wp-block-button__width-75 .wp-block-button__link{width:75%}.wp-block-button.wc-block-components-product-button.wp-block-button__width-100 .wp-block-button__link{width:100%}.wp-block-button.wc-block-components-product-button .wp-block-button__link{display:inline-flex;font-size:1em;justify-content:center;text-align:center;white-space:normal;width:auto;word-break:break-word}.wp-block-button.wc-block-components-product-button a[hidden]{display:none}@keyframes slideOut{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes slideIn{0%{opacity:0;transform:translateY(90%)}to{opacity:1;transform:translate(0)}}.wp-block-button.wc-block-components-product-button.align-left{align-items:flex-start}.wp-block-button.wc-block-components-product-button.align-right{align-items:flex-end}.wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button{align-items:center;border-style:none;display:inline-flex;justify-content:center;line-height:inherit;overflow:hidden;white-space:normal;word-break:break-word}.wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button span.wc-block-slide-out{animation:slideOut .1s linear 1 normal forwards}.wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button span.wc-block-slide-in{animation:slideIn .1s linear 1 normal}.wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button--placeholder{background-color:currentColor!important;border:0!important;border-radius:.25rem;box-shadow:none;color:currentColor!important;display:block;line-height:1;max-width:100%!important;min-height:3em;min-width:8em;opacity:.15;outline:0!important;overflow:hidden!important;pointer-events:none;position:relative!important;width:100%;z-index:1}.wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button--placeholder>*{visibility:hidden}.wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button--placeholder:after{animation:loading__animation 1.5s ease-in-out infinite;background-image:linear-gradient(90deg,currentColor,hsla(0,0%,96%,.302),currentColor);background-repeat:no-repeat;content:" ";display:block;height:100%;left:0;position:absolute;right:0;top:0;transform:translateX(-100%)}@keyframes loading__animation{to{transform:translateX(100%)}}@media screen and (prefers-reduced-motion:reduce){.wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button--placeholder{animation:none}}.wc-block-all-products .wp-block-button.wc-block-components-product-button{margin-bottom:12px}.theme-twentytwentyone .editor-styles-wrapper .wc-block-components-product-button .wp-block-button__link{background-color:var(--button--color-background);border-color:var(--button--color-background);color:var(--button--color-text)}

    </style>
    <style id='woocommerce-product-collection-style-inline-css'>
    .wp-block-woocommerce-product-collection .wc-block-components-product-stock-indicator{text-align:center}.wc-block-components-notice-banner .wc-block-components-button.wc-block-components-notice-banner__dismiss[hidden]{display:none}

    </style>
    <style id='woocommerce-product-filters-style-inline-css'>
    :where(.wc-block-product-filters){--top-padding:var(--wp-admin--admin-bar--height);display:inline-flex}@media(max-width:782px){:where(.wc-block-product-filters){--top-padding:var(--adminbar-mobile-padding,0)}}:where(.wc-block-product-filters) .wc-block-product-filters__close-overlay,:where(.wc-block-product-filters) .wc-block-product-filters__open-overlay{align-items:center;background:transparent;border:transparent;color:inherit;display:flex;font-size:.875em;padding:0}:where(.wc-block-product-filters) .wc-block-product-filters__close-overlay svg,:where(.wc-block-product-filters) .wc-block-product-filters__open-overlay svg{fill:currentColor}:where(.wc-block-product-filters) .wc-block-product-filters__close-overlay span,:where(.wc-block-product-filters) .wc-block-product-filters__open-overlay span{padding:0 5px}:where(.wc-block-product-filters) .wc-block-product-filters__open-overlay svg{height:var(--wc-product-filters-overlay-icon-size,1.5em);width:var(--wc-product-filters-overlay-icon-size,1.5em)}:where(.wc-block-product-filters) .wc-block-product-filters__overlay{background-color:transparent;inset:0;pointer-events:none;position:fixed;top:var(--top-padding);transition:background-color .5s;z-index:9999}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-wrapper{height:100%;position:relative;width:100%}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-dialog{background-color:var(--wc-product-filters-overlay-background-color,var(--wc-product-filters-background-color,var(--wp--preset--color--base,#fff)));color:var(--wc-product-filters-overlay-text-color,var(--wc-product-filters-text-color,var(--wp--preset--color--base,#111)));display:flex!important;flex-direction:column;gap:var(--wp--preset--spacing--40);inset:0;max-height:100%;position:absolute;transform:translateY(100vh);transition:none}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-header{display:flex;flex-flow:row-reverse;padding:var(--wp--preset--spacing--30) var(--wp--preset--spacing--40) 0}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-content{display:flex;flex-direction:column;flex-grow:1;gap:var(--wc-product-filter-block-spacing,var(--wp--style--block-gap,1.2rem));overflow-y:scroll;padding:0 var(--wp--preset--spacing--40)}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-content>:first-child{margin-top:0}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-footer{box-shadow:0 -4px 8px 0 rgba(0,0,0,.102);padding:var(--wp--preset--spacing--30) var(--wp--preset--spacing--40)}:where(.wc-block-product-filters) .wc-block-product-filters__apply{width:100%}:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay{background-color:rgba(95,95,95,.35);pointer-events:auto;z-index:9999}:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay-dialog{color:var(--wc-product-filters-overlay-color,inherit);transform:translateY(0);transition:transform .5s}@media(min-width:601px){:where(.wc-block-product-filters),:where(.wc-block-product-filters).is-overlay-opened{display:flex}:where(.wc-block-product-filters) .wc-block-product-filters__open-overlay,:where(.wc-block-product-filters) .wc-block-product-filters__overlay-footer,:where(.wc-block-product-filters) .wc-block-product-filters__overlay-header,:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__open-overlay,:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay-footer,:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay-header{display:none}:where(.wc-block-product-filters) .wc-block-product-filters__overlay,:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay{background:inherit;color:inherit;inset:0;pointer-events:auto;position:relative;transition:none}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-wrapper,:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay-wrapper{background:inherit;color:inherit;height:auto;width:auto}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-dialog,:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay-dialog{background:inherit;color:inherit;position:relative;transform:none}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-content,:where(.wc-block-product-filters).is-overlay-opened .wc-block-product-filters__overlay-content{background:inherit;color:inherit;flex-grow:1;overflow:visible;padding:0}}@media(max-width:600px){:where(.wc-block-product-filters) .wc-block-product-filters__overlay-content .wp-block-group{display:block}:where(.wc-block-product-filters) .wc-block-product-filters__overlay-content .wp-block-group>div{margin:20px 0}}.wc-block-product-filter--hidden{display:none}

    </style>
    <link rel='stylesheet' id='woocommerce-product-filter-price-slider-style-css' href='https://live.local/wp-content/plugins/woocommerce/assets/client/blocks/woocommerce/product-filter-price-slider-style.css' media='all'>
    <style id='woocommerce-product-filter-removable-chips-style-inline-css'>
    .wc-block-product-filter-removable-chips.is-vertical .wc-block-product-filter-removable-chips__items{flex-direction:column}.wc-block-product-filter-removable-chips.is-content-justification-center .wc-block-product-filter-removable-chips__items{justify-content:center}.wc-block-product-filter-removable-chips.is-content-justification-right .wc-block-product-filter-removable-chips__items{justify-content:flex-end}.wc-block-product-filter-removable-chips.is-content-justification-space-between .wc-block-product-filter-removable-chips__items{justify-content:space-between}.wc-block-product-filter-removable-chips.is-horizontal .wc-block-product-filter-removable-chips__items{width:100%}.wc-block-product-filter-removable-chips__items{color:var(--wc-product-filter-removable-chips-text,currentColor);display:inline-flex;flex-wrap:wrap;gap:4px;list-style:none;margin:0;padding:0}.wc-block-product-filter-removable-chips__items .wc-block-product-filter-removable-chips__item{align-items:center;appearance:none;background:var(--wc-product-filter-removable-chips-background,transparent);border:1px solid var(--wc-product-filter-removable-chips-border,color-mix(in srgb,currentColor 20%,transparent));border-radius:2px;display:flex;font-size:.875em;gap:8px;justify-content:space-between;padding:.25em .75em}.wc-block-product-filter-removable-chips__items .wc-block-product-filter-removable-chips__item .wc-block-product-filter-removable-chips__remove{align-items:center;background-color:transparent;border:none;color:var(--wc-product-filter-removable-chips-text,currentColor);cursor:pointer;display:flex;margin:0;padding:0}.wc-block-product-filter-removable-chips__items .wc-block-product-filter-removable-chips__item .wc-block-product-filter-removable-chips__remove .wc-block-product-filter-removable-chips__remove-icon{fill:currentColor}

    </style>
    <style id='woocommerce-product-filter-checkbox-list-style-inline-css'>
    .wc-block-product-filter-checkbox-list__list{list-style:none outside;margin:0;padding:0}.wc-block-product-filter-checkbox-list__label{align-items:center;display:inline-flex;gap:.625em}.wc-block-product-filter-checkbox-list__item .wc-block-product-filter-checkbox-list__label{margin-bottom:0}:where(.wc-block-product-filter-checkbox-list__input-wrapper){display:block;position:relative}.wc-block-product-filter-checkbox-list__input-wrapper:before{background:currentColor;border-radius:2px;content:"";height:1em;left:0;opacity:.1;pointer-events:none;position:absolute;top:0;width:1em}.has-option-element-color .wc-block-product-filter-checkbox-list__input-wrapper:before{display:none}input[type=checkbox].wc-block-product-filter-checkbox-list__input{appearance:none;background:var(--wc-product-filter-checkbox-list-option-element,transparent);border:1px solid var(--wc-product-filter-checkbox-list-option-element-border,transparent);border-radius:2px;color:inherit;cursor:pointer;display:block;font-size:inherit;height:1em;margin:0;width:1em}input[type=checkbox].wc-block-product-filter-checkbox-list__input:focus{outline-color:var(--wc-product-filter-checkbox-list-option-element-border,currentColor);outline-width:1px}svg.wc-block-product-filter-checkbox-list__mark{box-sizing:border-box;color:var(--wc-product-filter-checkbox-list-option-element-selected,currentColor);display:none;height:1em;left:0;padding:.2em;position:absolute;top:0;width:1em}input[type=checkbox].wc-block-product-filter-checkbox-list__input:checked:after,input[type=checkbox].wc-block-product-filter-checkbox-list__input:checked:before{content:none}input[type=checkbox].wc-block-product-filter-checkbox-list__input:checked+.wc-block-product-filter-checkbox-list__mark{display:block;pointer-events:none}:where(.wc-block-product-filter-checkbox-list__text-wrapper){align-items:center;display:inline-flex;font-size:.875em;gap:4px}.wc-block-product-filter-checkbox-list__show-more{appearance:none;background:transparent;border:none;font-family:inherit;padding:0;text-decoration:underline}

    </style>
    <style id='woocommerce-product-filter-chips-style-inline-css'>
    :where(.wc-block-product-filter-chips__items){display:flex;flex-wrap:wrap;gap:4px}.wc-block-product-filter-chips__item{appearance:none;background:transparent;border:1px solid color-mix(in srgb,currentColor 20%,transparent);border-radius:2px;color:var(--wc-product-filter-chips-text,currentColor);cursor:pointer;font-family:inherit;font-size:.875em;padding:4px 8px}.has-chip-text-color .wc-block-product-filter-chips__item{color:var(--wc-product-filter-chips-text)}.has-chip-background-color .wc-block-product-filter-chips__item{background:var(--wc-product-filter-chips-background)}.has-chip-border-color .wc-block-product-filter-chips__item{border-color:var(--wc-product-filter-chips-border)}.wc-block-product-filter-chips__item[aria-checked=true]{background:currentColor}.has-selected-chip-text-color .wc-block-product-filter-chips__item[aria-checked=true]{color:var(--wc-product-filter-chips-selected-text)}.has-selected-chip-background-color .wc-block-product-filter-chips__item[aria-checked=true]{background:var(--wc-product-filter-chips-selected-background)}.has-selected-chip-border-color .wc-block-product-filter-chips__item[aria-checked=true]{border-color:var(--wc-product-filter-chips-selected-border)}:where(.wc-block-product-filter-chips__label){align-items:center;display:inline-flex;gap:4px}.wc-block-product-filter-chips:not(.has-selected-chip-text-color) .wc-block-product-filter-chips__item[aria-checked=true]>.wc-block-product-filter-chips__label{filter:invert(100%)}.wc-block-product-filter-chips__show-more{appearance:none;background:transparent;border:none;font-family:inherit;padding:0;text-decoration:underline}

    </style>
    <link rel='stylesheet' id='woocommerce-product-gallery-style-css' href='https://live.local/wp-content/plugins/woocommerce/assets/client/blocks/woocommerce/product-gallery-style.css' media='all'>
    <style id='woocommerce-product-template-style-inline-css'>
    .wc-block-product-template{list-style:none;margin-bottom:0;margin-top:0;max-width:100%;padding:0}.wc-block-product-template.wc-block-product-template{background:none}.wc-block-product-template.is-flex-container{display:flex;flex-direction:row;flex-wrap:wrap;gap:1.25em}.wc-block-product-template.is-flex-container>li{list-style:none;margin:0;width:100%}@media(min-width:600px){.wc-block-product-template.is-flex-container.is-flex-container.columns-2>li{width:calc(50% - .625em)}.wc-block-product-template.is-flex-container.is-flex-container.columns-3>li{width:calc(33.33333% - .83333em)}.wc-block-product-template.is-flex-container.is-flex-container.columns-4>li{width:calc(25% - .9375em)}.wc-block-product-template.is-flex-container.is-flex-container.columns-5>li{width:calc(20% - 1em)}.wc-block-product-template.is-flex-container.is-flex-container.columns-6>li{width:calc(16.66667% - 1.04167em)}}.wc-block-product-template__responsive{grid-gap:1.25em;display:grid}.wc-block-product-template__responsive.columns-2{grid-template-columns:repeat(auto-fill,minmax(max(150px,calc(50% - .625em)),1fr))}.wc-block-product-template__responsive.columns-3{grid-template-columns:repeat(auto-fill,minmax(max(150px,calc(33.33333% - .83333em)),1fr))}.wc-block-product-template__responsive.columns-4{grid-template-columns:repeat(auto-fill,minmax(max(150px,calc(25% - .9375em)),1fr))}.wc-block-product-template__responsive.columns-5{grid-template-columns:repeat(auto-fill,minmax(max(150px,calc(20% - 1em)),1fr))}.wc-block-product-template__responsive.columns-6{grid-template-columns:repeat(auto-fill,minmax(max(150px,calc(16.66667% - 1.04167em)),1fr))}.wc-block-product-template__responsive>li{margin-block-start:0}:where(.wc-block-product-template .wc-block-product)>:not(:last-child){margin-bottom:.75rem;margin-top:0}.is-product-collection-layout-list .wc-block-product:not(:last-child){margin-bottom:1.2rem}

    </style>
Viewing 7 replies - 1 through 7 (of 7 total)
  • I try this code (funtions.php) it’s working for my demo site. And my real site is not working.

    // Remove WooCommerce CSS 9.9.x
    function remove_woocommerce_styles() {
    wp_dequeue_style(‘woocommerce-product-button-style’);
    wp_dequeue_style(‘woocommerce-product-filters-style’);
    wp_dequeue_style(‘woocommerce-product-filter-price-slider-style’);
    wp_dequeue_style(‘woocommerce-product-filter-removable-chips-style’);
    wp_dequeue_style(‘woocommerce-product-filter-checkbox-list-style’);
    wp_dequeue_style(‘woocommerce-product-filter-chips-style’);
    wp_dequeue_style(‘woocommerce-product-gallery-style’);
    wp_dequeue_style(‘woocommerce-product-template-style’);
    }
    add_action(‘wp_enqueue_scripts’, ‘remove_woocommerce_styles’, 99999);
    add_action(‘wp_head’, ‘remove_woocommerce_styles’, 99999);

    // remove inline CSS WooCommerce
    function remove_woocommerce_inline_css() {
    wp_add_inline_style(‘woocommerce-inline’, ”);
    remove_action(‘wp_head’, array(‘WC_Frontend_Scripts’, ‘add_inline_styles’));

    }
    add_action(‘wp_enqueue_scripts’, ‘remove_woocommerce_inline_css’, 999);
    add_action(‘init’, ‘remove_woocommerce_inline_css’);

    Thread Starter rorytatem

    (@rorytatem)

    wp_dequeue_style(‘woocommerce-product-button-style’);

    wp_dequeue_style(‘woocommerce-product-filters-style’);

    wp_dequeue_style(‘woocommerce-product-filter-price-slider-style’);

    wp_dequeue_style(‘woocommerce-product-filter-removable-chips-style’);

    wp_dequeue_style(‘woocommerce-product-filter-checkbox-list-style’);

    wp_dequeue_style(‘woocommerce-product-filter-chips-style’);

    wp_dequeue_style(‘woocommerce-product-gallery-style’);

    wp_dequeue_style(‘woocommerce-product-template-style’);

    wp_dequeue_style(‘woocommerce-add-to-cart-form-style’);

    wp_dequeue_style(‘woocommerce-product-collection-style’);

    Thanks for that, this would be all of them… If I could get them working. Still trying both locally and production site.

    // Disable WooCommerce blocks
    add_action('init', function () {
    add_filter( 'woocommerce_get_block_types', '__return_empty_array', PHP_INT_MAX );
    }, 9, );

    That works. The dev of SEO Framework provided it. Gets rid of all the block CSS output and he claims it increases performance by 20%.

      Thread Starter rorytatem

      (@rorytatem)

      Thanks for that, will try it out. It’s not the only issue i’m seeing though. I also have anything woocommerce related disbaled on non-woo pages, jquery etc.

      After updating my live site with the latest v. all the js is back, including jquery. Super frustrating.

      Works locally, doesn’t work live, same site, same code. I’m about to switch platforms altogether, years of this crap, can’t take it anymore.

      Plugin Support Mahfuzur Rahman(woo-hc)

      (@mahfuzurwp)

      Hi @rorytatem,

      I understand how frustrating this can be, especially when you’ve put a lot of effort into customizing your site. Currently, WooCommerce doesn’t have an option to fully disable all block-related styles and scripts, which are loaded by default for compatibility.

      Since you’re seeing differences between your local and live site, it might be due to caching or server setup. Checking those could help.

      If you’d like, I encourage you to create a feature request for a “Disable Blocks” option, many users would find that helpful. Thanks for sharing your feedback!

      You copy this code into the funtions.php file. It has worked on the real site. you can check my site: shopcon.vn

      // Remove WooCommerce CSS 9.9.x

      function remove_woocommerce_styles() {
      wp_dequeue_style(‘woocommerce-product-button-style’);
      wp_dequeue_style(‘woocommerce-product-filters-style’);
      wp_dequeue_style(‘woocommerce-product-filter-price-slider-style’);
      wp_dequeue_style(‘woocommerce-product-filter-removable-chips-style’);
      wp_dequeue_style(‘woocommerce-product-filter-checkbox-list-style’);
      wp_dequeue_style(‘woocommerce-product-filter-chips-style’);
      wp_dequeue_style(‘woocommerce-product-gallery-style’);
      wp_dequeue_style(‘woocommerce-product-template-style’);
      wp_dequeue_style(‘woocommerce-add-to-cart-form-style’);
      wp_dequeue_style(‘woocommerce-product-collection-style’);
      }
      add_action(‘wp_enqueue_scripts’, ‘remove_woocommerce_styles’, 99999);
      add_action(‘wp_head’, ‘remove_woocommerce_styles’, 99999);

      function remove_woocommerce_inline_css() {
      wp_add_inline_style(‘woocommerce-inline’, ”);

      remove_action(‘wp_head’, array(‘WC_Frontend_Scripts’, ‘add_inline_styles’));

      }
      add_action(‘wp_enqueue_scripts’, ‘remove_woocommerce_inline_css’, 999);
      add_action(‘init’, ‘remove_woocommerce_inline_css’);

      Previously, it didn’t work because I hadn’t completely cleared opcache. I cleared opcache by going into the ini.php file and turning off opcache: opcache.enable=0

      ;opcache.enable=1

      ;opcache.enable_cli=1

      ;opcache.memory_consumption=1024

      ;opcache.max_accelerated_files=60000

      ;opcache.interned_strings_buffer=51

      ;opcache.validate_timestamps=0

      ;opcache.revalidate_freq=0

      ;opcache.file_update_protection=0

      ;opcache.fast_shutdown=1

      ;opcache.file_cache=/tmp/opcache

      ;opcache.file_cache_only=0

      ;opcache.file_cache_consistency_checks=1

      Then go to the /tmp/opcache/ directory on the VPS and delete all files inside.

      After the code has worked, turn on opcache: opcache.enable=1

      Plugin Support Chris Moreira – a11n

      (@chrism245)

      I’m going to mark this as resolved, as we haven’t heard back from you in a while. Please open a new thread if you need further assistance.

      If you have a few minutes, we’d love if you could leave us a review: https://wordpress.org/support/plugin/woocommerce/reviews/

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