I am quite new to Woocommerce, however i do find the plugin very interesting, one thing that i would like to know is:
-
When on cart-page, if you were to empty the
table
via: -
WC()->cart->empty_cart()
OR -
foreach
item in thetable
:
WC()->cart->set_quantity("cart_item_key_id" , 0)
You would get redirected to the "Cart is empty"
display where only this message is displayed. The table
would however disappear and also not be part of the DOM
.
Question
How to make sure that the table
remains in the place even if it doesn’t have any items ? Or alternatively while having an child-theme
with all the files, one example: your-theme/woocommerce/cart/cart.php
, how to, while being on the cart-page and seeing the “cart is empty” message, modify the cart.php
so, add an item programmtically and regenerate the table
.
What i tried
Removed the woocommerce_cart_is_empty message via
remove_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );
which was added to functions.php
file.
It did remove the message, however it didnt fix the problem, that the table
is also gone.
Cart-page without the “cart is empty” message