Archived topic
Empty cart page template
3 replies · Started by Krzysztof on April 21, 2020
Hello, is there some sort of template I can use on empty cart? Default one when it is emptied is just as it is, I wanted to add something without too much coding.
Hi there,
you could do this:
1. Add this PHP Snippet to remove the Cart is Empty message:
remove_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );
2. Then you can add your own content by using a Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
2.1 Add you content to the text area.
2.2 From the Hook List select Custom Hook and add this to field provided woocommerce_cart_is_empty
2.3 If you added PHP or Shortcodes to your hook content then check those boxes.
2.4 Set your Display Rules to Page > Cart
Hey David, thanks for reply. It almost works.
I put my code into Elements area, and here is a fun part. When I remove last product from the cart - when I am at cart page, it just leaves it blank, but if I do reload (F5), it loads what I wanted to put there just fine...
Okay, I figured that this snippet is not required, but, if I don't reload, it actually ignores CSS from Elementor (I made a template in it, and put shortcode to it in this element)
If you're using Elementor to create the Cart page you will need to ask their support for help. Sorry but its out of our scope and i don't know what the solution would be.