Last active
January 1, 2019 06:59
-
-
Save ishaadX/aab0fc6ee325c23d7b9c5261fdbad845 to your computer and use it in GitHub Desktop.
Woocommerce Product add to cart while logged out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
i have same empty cart problem.i am trying to paste your code but function.php dont work ?
can you help ?