Home Forums WoodMart support forum How to hide view cart button in mini cart via code

How to hide view cart button in mini cart via code

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #563645

    thomas-8605
    Participant

    Hello,

    we wanna remove VIEW CART button from mini cart.
    Most simple way is via CSS. But its not the best way about performance.

    So we try this snippet to remove it from mini cart:

    add_action( ‘woocommerce_widget_shopping_cart_buttons’, ‘bbloomer_remove_view_cart_minicart’, 1 );

    function bbloomer_remove_view_cart_minicart() {
    remove_action( ‘woocommerce_widget_shopping_cart_buttons’, ‘woocommerce_widget_shopping_cart_button_view_cart’, 10 );
    }

    But its not working in woodmart, but in all other themes we tested before.
    Coud you tell me the correct function name or how to remove view cart button without css please?
    We need to find a script solution and not via CSS.

    All the codes on internet working for most of all themes. But on woodmart no one is working.

    BR
    Tommy

    Attachments:
    You must be logged in to view attached files.
    #563713

    Hung Pham
    Keymaster

    Hi thomas-8605,

    Thanks for reaching to us.

    To assist you in the best possible manner, I kindly ask that you please provide me temporary wp-admin info (wp-admin URL, username, password) to the Private Content area, this will allow me to thoroughly investigate and address your concerns more efficiently.

    Regards,

    #563759

    thomas-8605
    Participant

    Hello Hung,

    thank you for your support.
    We already wrote with woocommerce support and they confirmed: if your theme working with correct hooks and functions, it shoud be possible to remove the not needed element via remove_action …

    Please find attached our login data.

    BR
    Tommy

    #563981

    Hung Pham
    Keymaster

    Hi thomas-8605,

    Thanks for details.

    Please add below code to functions.php file in Child theme, I helped you to do that

    if ( ! function_exists( 'woodmart_mini_cart_view_cart_btn' ) ) {
    	function woodmart_mini_cart_view_cart_btn() {
    		return;
    	}
    	remove_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_button_view_cart', 10 );
    	add_action( 'woocommerce_widget_shopping_cart_buttons', 'woodmart_mini_cart_view_cart_btn', 10 );
    }

    Please remove products from cart and re-add to see the changes.

    Regards,

Viewing 4 posts - 1 through 4 (of 4 total)