• Hi All,

    I have a number of style changes I wish to make, however some of these are not just Storefront theme specific, some alterations relate to woocommerce.

    Woocommerce style sheets load after both the parent storefront/style.css file and also the storefront-child/style.css file

    With this in mind I thought it would be simpler to adjust the order in which the stylesheets were loaded. To that end I add the following code to my childs function.php file all though this works it now loads the child/style.css file twice. Once in its original placement and priorty and again in the revised location (where I would like it to stay).

    Can you please tell me how I should remove the original loading of the child/style.css file.

    Many Thanks Paul

    INSERTED CODE HERE:-

    /**
     * Remove original location / priority of storefront theme style sheet
    */
    remove_action( 'wp_enqueue_scripts', 'enqueue_parent_theme_style' );
    
    /**
     * Enqueue original storefront theme style sheet at higher priority of 50
     * @uses wp_enqueue_scripts <https://codex.www.ads-software.com/Function_Reference/wp_enqueue_style>
     */
    add_action('wp_enqueue_scripts', 'enqueue_parent_theme_style', 50 );
    function enqueue_parent_theme_style() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }
    
    /**
     * Enqueue child storefront theme style sheet at higher priority of 51
     * @uses wp_enqueue_scripts <https://codex.www.ads-software.com/Function_Reference/wp_enqueue_style>
     */
    
    add_action( 'wp_enqueue_scripts', 'load_my_child_styles', 51 );
    function load_my_child_styles() {
        wp_enqueue_style( 'child-style', get_stylesheet_directory_uri().'/style.css' );
    }

Viewing 1 replies (of 1 total)
  • Hi,

    WooCommerce core stylesheets shouldn’t load when using Storefront, it purposely disables them.

    To add a new stylesheet that loads after all the others, just set the priority accordingly on the function you’re hooking into wp_enquque_scripts.

Viewing 1 replies (of 1 total)
  • The topic ‘Change Priority order of style sheets’ is closed to new replies.