1

I am using elementor and woocommerce on my website. in the header is the elementor mini cart widget (Menu Cart Widget). in the widget configuration is: Cart type: 'side cart'.

Using the code snippets plugin I want to add custom text located below the 'view cart' and 'checkout' buttons (they have '.elementor-menu-cart__footer-buttons' as CSS class), the text to add below the buttons is: "free shipping in Lima"

I use this code, but it doesn't work, the custom text is in every product, I want only one time before or after the "view cart" "checkout" buttons


add_filter( 'woocommerce_widget_cart_item_quantity', 'add_custom_text_below_menu_cart_buttons', 10, 2 );
function add_custom_text_below_menu_cart_buttons( $quantity, $cart_item_key ) {
    // custom text here
    $custom_text = 'free shipping in Lima';

    // wrap the custom text in a div with a custom class
    $custom_text = '<div class="custom-text">' . $custom_text . '</div>';

    // append the custom text to the cart widget
    $quantity .= $custom_text;

    return $quantity;
}

0 Answers0