• Resolved andyt1980

    (@andyt1980)


    Hi,
    I wanted to move the cart area up and inline with the search box in the header.
    I managed to achieve this by using the following code:

    remove_action( 'storefront_header', 'storefront_header_cart', 60 );
    add_action( 'storefront_header', 'storefront_header_cart', 35 );

    This works, however it also leaves the original cart in place too, so I managed to remove this by using this code:

    add_action( 'init', 'jk_remove_storefront_cart' );
    function jk_remove_storefront_cart() {
    remove_action( 'storefront_header', 'storefront_header_cart', 60 );
    }

    Is this the best way to achieve this as it appears I am having to remove the cart twice?.

    thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey,

    Best to just move all your code into that new function. This should be all you need;

    add_action( 'init', 'jk_remove_storefront_cart' );
    function jk_remove_storefront_cart() {
    add_action( 'storefront_header', 'storefront_header_cart', 35 );
    remove_action( 'storefront_header', 'storefront_header_cart', 60 );
    }

    Cheers

    Thread Starter andyt1980

    (@andyt1980)

    Works great thank you – I’m only just learning about hooks but it seems they will be very helpful in future.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Changing Position of Cart & Search Box’ is closed to new replies.