I've made a single-page checkout template for donations. The donation plugin is attached to the cart and will update the cart properly, however the cart will not display on my page if 0 items are in the basket when the user arrives. The intended end user will generally have no items in their cart.
How can I force the WooCommerce cart to show up if there are no products in the cart?
WC_Cart::is_empty()
toreturn false
on you custom template or page. Seems the actionwoocommerce_cart_loaded_from_session
may be the best place to trick the logic. I solved my current problem by changing the is_empty() function directly - which is a wrong solution. ---function is_empty(){ global $wp; $current_url = home_url(add_query_arg(array(),$wp->request)); if($current_url==$CheckoutURL) return false; return 0 === sizeof( $this->get_cart() ); }
As you may note, sizeof($this->get_cart()) is ultimately the deciding factor.