Good afternoon, I have built a website for me client using Wordpress/Woocommerce. the site works great but one problem is that the basket/session doesn't clear after the order is finished. It looks to me that WooCommerce doesn't even have the feature as standard. Working with the Woocommece standard files, whats the best way to kill a session after the checkout process is complete?
Is there a way around this?
The cart should empty as this feature is standard, empty_cart();
Are you using any cache-plugins? In that case you need to exclude the cart page http://docs.woothemes.com/document/configuring-caching-plugins/
It could also be a problem with the payment-gateway, make sure you have updated to the latest version.
i found a similar question but it clears the cart on the click of a button.. http://wordpress.org/support/topic/add-an-empty-cart-button-to-cart-page seems to have worked for some user.. here is the code , it should go in to the function.php file
this is the code for the button
im guessing u dont need a button, so in the next page when u want the cart to be empty, u can explicitly call this function _e('Empty Cart', 'woocommerce');
for example if it you would like to clear the cart in a post page whose title is Payment Success
or if its slug is payment-success
similarly to check if its homepage you can use
or if its on the wordpress page u can use this
you can include the above code in the head section of your wordpress site!!
Hope this helps
Your cart should be clearing after checkout so something else may be wrong.
You could create a function with
empty_cart()
in it that is triggered when payment is complete "just in case". See: http://docs.woothemes.com/wc-apidocs/class-WC_Cart.htmlYou can user this hook :
Or you can check woocommerce hook list from here.