• Hi,

    I want to remove the cart link from my Storefront theme header, since I am not going to sell products directly but redirect to other websites. My website is bestmobilecovers.in.

    I am talking about removing this part of the header->
    Cart link

    Have been frantically trying to find a solution, but all in vain. Please help!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi,

    I use the Storefront Pro plugin for that from Pootlepress.
    Awesome to configure Storefront theme and remove cart link with one click.

    Hope this helps,
    Annie

    Thread Starter sudeepaffiliate

    (@sudeepaffiliate)

    Any way to do it without purchasing the plugin?

    If you put the following code in your child theme’s style.css:

    #main-nav-cart{
    
    display:none
    
    }

    the cart should be removed as well ??

    Thread Starter sudeepaffiliate

    (@sudeepaffiliate)

    This is not working for me ??

    Also, some clarification – I have storefront theme installed. Also, the style.css looks illegible.

    Please help.

    Do you have a storefront child theme created?

    Never edit the actual parent theme ( storefront in this case ).
    Always edit the child theme!

    https://www.pootlepress.com/shop/free-blank-woothemes-storefront-child-theme/

    Just tried it in a test site to make sure the code still works, but it did no longer hide the cart at this point.

    Maybe the recent updates to Storefront made this code outdated…

    Thread Starter sudeepaffiliate

    (@sudeepaffiliate)

    ?? ??

    Any other way?

    You might find a solution here:
    https://wooassist.com/category/code-snippets/

    They present lots of code snippets for storefront.

    Putting this code into the function.php ( child theme ) might do the trick:

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

    I have not tested this, so not sure it still works. Make sure to test this and/or take a backup first.

    • This reply was modified 8 years, 6 months ago by LogoLogics.
    • This reply was modified 8 years, 6 months ago by LogoLogics.
    somewhereman

    (@somewhereman)

    has anybody figured this out to a successful conclusion

    there are lots of ideas but none of them work for storefront

    Adding the following code into the function.php (storefront theme) worked for me

    */
    add_action( ‘init’, ‘jk_remove_storefront_header_search’ );
    function jk_remove_storefront_header_search() {
    remove_action( ‘storefront_header’, ‘storefront_product_search’, 40 );
    }
    /**

    As LogoLogics suggested above, it should be possible to use CSS rules to stop it displaying.

    The code they linked above would work, except perhaps a theme update has changed the div ID targeted.

    At the time of writing, the current div ID is

    #site-header-cart{
    
    display:none
    
    }

    This can be added to the ‘Additional CSS’ under ‘Customize’ for the theme.

    You may also want to remove the bar on mobile that displays the cart. Some info for doing that is here:
    https://docs.woocommerce.com/document/customize-the-links-in-the-handheld-footer-bar/

    When making those changes, its suggested to use this theme customisation plugin. Such that if woocommerce updates, you don’t lose the code you added.

    Hi aph5, your answer was great. but i still cannot solve the issue on how to remove the bar on mobile and tablet.The info you provide not able to solve my proble. Why not you just provide the code ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Remove cart link from header’ is closed to new replies.