Skip to content

Instantly share code, notes, and snippets.

@ishaadX
Last active January 1, 2019 06:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishaadX/aab0fc6ee325c23d7b9c5261fdbad845 to your computer and use it in GitHub Desktop.
Save ishaadX/aab0fc6ee325c23d7b9c5261fdbad845 to your computer and use it in GitHub Desktop.
Woocommerce Product add to cart while logged out
Copy and paste this code on functions.php file in wordpress theme....
add_action( 'woocommerce_add_to_cart' , 'repair_woocommerce_session_add_to_cart');
function repair_woocommerce_session_add_to_cart( ){
if ( defined( 'DOING_AJAX' ) ) {
wc_setcookie( 'woocommerce_items_in_cart', 1 );
do_action( 'woocommerce_set_cart_cookies', true );
}
}
@muratcatak
Copy link

Hi,
i have same empty cart problem.i am trying to paste your code but function.php dont work ?
can you help ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment