(HELP) If anyone has some good knowledge of WooCommerce

prey24

Elite Member
Jr. VIP
Joined
Dec 16, 2017
Messages
2,112
Reaction score
1,726
Hey,

I got in a issue with WooCommerce cart and checkout, If anyone has knowledge please hit me.

Will appreciate !!
Thanks
 
Hey,

I got in a issue with WooCommerce cart and checkout, If anyone has knowledge please hit me.

Will appreciate !!
Thanks
Paid work, or free work? If paid work, then it should have been posted in HaF with proper budget. If free work, I recommend doing it in the thread instead of in the PM. :)
 
:) what is your problem? .. just describe it here
 
:) what is your problem? .. just describe it here

Well i need some arrangement through which i can empty the cart as soon as some returns back in the browser. I don't want to remove the cart i just want it empty when someone returns to the store. Is this possible?
 
Well i need some arrangement through which i can empty the cart as soon as some returns back in the browser. I don't want to remove the cart i just want it empty when someone returns to the store. Is this possible?
You could try sending an ajax request on "onbeforeunload" JS event that clears the cart, but then it could have negative effect if user goes to another page instead of closing the browser.

Or, if user comes back to the index page of your site, you could do something like:
Code:
/*empty cart if user come to homepage*/
add_action( 'init', 'woocommerce_clear_cart_url' );
function woocommerce_clear_cart_url() {
    global $woocommerce;
    if ($_SERVER['REQUEST_URI'] === '/') {
        $woocommerce->cart->empty_cart();
    }
}
 
Back
Top