I have tried to apply this functionality -to empy the cart once user logs out- by adding some PHP code in my functions.php file, but no luck.
e.g.
1) add_action( 'wp_logout', 'woocommerce_empty_cart' );
2) function your_function() {
if( function_exists('WC') ){
WC()->cart->empty_cart();
}
}
add_action('wp_logout', 'your_function');
Do you have something in mind for that? Is this related to BuddyPress log in flow?
hi
you can search that out "clear cart on logout"
i have searched that and found some links you can try them out:
https://wordpress.org/support/topic/woocommerce-clear-cart-on-user-logout/
https://wordpress.stackexchange.com/questions/324961/woocommerce-cart-is-not-clear-after-logout/324963
https://njengah.com/woocommerce-clear-cart-on-logout/
https://stackoverflow.com/questions/32785328/woocommerce-clear-cart-on-user-logout
yes, I have tried all these, but no luck
for that make sure you have enabled both the sync in vibebp>>settings
Hi,
these are my settings
https://1drv.ms/u/s!AioWO8Qvek_2mMQ15uElWzq5PJJq6A?e=TJufLI
these are my settings
https://1drv.ms/u/s!AioWO8Qvek_2mMQ15uElWzq5PJJq6A?e=TJufLI
hi
the delay in response is due to support holiday
checking the code will provide here
shortly
hi
add this code in wplms-customizer.php
`add_action( 'wp_logout', 'force_clear_woocommerce_cart' );
function force_clear_woocommerce_cart()
{
error_log("Clearing cart");
global $woocommerce;
$woocommerce->cart->empty_cart();
}`
this will clear the cart once the user is logged out from the WordPress area
this is tested on local and working
I have tried this in functions.php and it did not work.
How can I access the wplms-customizer.php file ?
Shall I go through the cpanel file manager, or I can find in the wp admin area ?
hi
if you don't have the plugin then download it form here:
https://wplms.io/support/wp-content/uploads/2015/08/wplms-customizer.zip
and also you can edit the wplms-customizer.php
from wp-admin>>plugins>>plugin editor>>select the wplms customizer plugin and then edit the file and update it