wp_deregister_style – Ignore dependency rule and keep the “children” loaded

Question

How to stop loading Storefront theme icons (storefront-icons) via functions.php? I just tried to execute below code but it also block loading storefront-woocommerce-style dependency and inline styles which comes from the customizer.

function remove_storefront_styles(){
wp_deregister_style('storefront-icons');
}
add_action('wp_print_styles', 'remove_storefront_styles'); 

All I need is to stop loading storefront-icons but keep all the dependencies.

I found this in the source code. It explains how the theme calling storefront-icons. Hope it helps:

        /**
         * WooCommerce specific scripts & stylesheets
         *
         * @since 1.0.0
         */
        public function woocommerce_scripts() {
            global $storefront_version;

            $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';

            wp_enqueue_style( 'storefront-woocommerce-style', get_template_directory_uri() . '/assets/css/woocommerce/woocommerce.css', array( 'storefront-style', 'storefront-icons' ), $storefront_version );
            wp_style_add_data( 'storefront-woocommerce-style', 'rtl', 'replace' );

            wp_register_script( 'storefront-header-cart', get_template_directory_uri() . '/assets/js/woocommerce/header-cart' . $suffix . '.js', array(), $storefront_version, true );
            wp_enqueue_script( 'storefront-header-cart' );

            wp_enqueue_script( 'storefront-handheld-footer-bar', get_template_directory_uri() . '/assets/js/footer' . $suffix . '.js', array(), $storefront_version, true );

            if ( ! class_exists( 'Storefront_Sticky_Add_to_Cart' ) && is_product() ) {
                wp_register_script( 'storefront-sticky-add-to-cart', get_template_directory_uri() . '/assets/js/sticky-add-to-cart' . $suffix . '.js', array(), $storefront_version, true );
            }
        }

If I can fix that I will upload my own CSS instead of icon.css

Best regards.

0
, , , , Serdar Kocak 2 years 2020-08-24T18:10:20-05:00 0 Answers 49 views 0

Leave an answer

Browse
Browse