Home Forums WoodMart – Premium Template Empty Cart Notice

This topic contains 6 replies, has 4 voices, and was last updated by Elise Noromit Elise Noromit 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #138029

    Joe
    Junior consultant

    Woocommerce 3.7 breaks the styling of the empty cart page.

    Woocommerce change #23152
    Enhancement – Format empty cart message as information notice.

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

    Hello,

    Please add this code to functions.php of the child theme

    /**
     * Remove default empty cart text
     */
    remove_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );
    if ( ! function_exists( 'woodmart_wc_empty_cart_message' ) ) {
        /**
         * Show notice if cart is empty.
         *
         * @since 1.0.0
         */
        function woodmart_wc_empty_cart_message() {
            ?>
            <p class="cart-empty">
                <?php echo wp_kses_post( apply_filters( 'wc_empty_cart_message', __( 'Your cart is currently empty.', 'woocommerce' ) ) ); ?>
            </p>
            <?php
        }
        add_action( 'woocommerce_cart_is_empty', 'woodmart_wc_empty_cart_message', 10 );
    }

    Best Regards

    #138511

    psivel
    Customer

    Hi,

    I have the same issue but when adding your code I get a duplicated empty message with a big brown banner that pops-up at the bottom of the screen and the closing cross just in the middle of the line. See attachment. How to get rid of this ?

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

    Hello,

    Try to replace the code with the following one

    function woodmart_remove_cart_msg() {
    	/**
    	 * Remove default empty cart text
    	 */
    	remove_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );
    }
    add_action( 'wp', 'woodmart_remove_cart_msg', 10 );
    
    if ( ! function_exists( 'woodmart_wc_empty_cart_message' ) ) {
    	/**
    	 * Show notice if cart is empty.
    	 *
    	 * @since 1.0.0
    	 */
    	function woodmart_wc_empty_cart_message() {
    		?>
    		<p class="cart-empty">
    			<?php echo wp_kses_post( apply_filters( 'wc_empty_cart_message', __( 'Your cart is currently empty.', 'woocommerce' ) ) ); ?>
    		</p>
    		<?php
    	}
    	add_action( 'woocommerce_cart_is_empty', 'woodmart_wc_empty_cart_message', 10 );
    }
    

    Kind Regards
    XTemos Studio

    #138770

    psivel
    Customer

    Thank you but it’s worse. Now the brown banner is still here but the main message above the button has disappeared…

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

    psivel
    Customer

    Hmm no I’m sorry it works I was looking the wrong website 🙁

    Thank you !

    #138791

    You are welcome! If you have any questions please feel free to contact us.

    Best Regards

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

The topic ‘Empty Cart Notice’ is closed to new replies.