WP eCommerce
Shopping cart not saving items after logout (14 posts)

  1. tostrye
    Posted 3 years ago #

    I have a store set up, and when a user adds an item, I would like the shopping cart to save the item(s) in the cart after the user logs out. I recently updated the WPEC plugin, is that the issue?


  2. wpviking34536
    Posted 3 years ago #

    i am having similar problem.

  3. wpviking34536
    Posted 3 years ago #

    i have "Keep items in cart" set to 30 days, but when user logs out and then logs in, items disappear. Can someone help?

  4. Justin Sainton
    Plugin Author

    Posted 3 years ago #

    What version of WPeC are you running?

  5. wpviking34536
    Posted 3 years ago #

    WP E-commerce Version

  6. Justin Sainton
    Plugin Author

    Posted 3 years ago #

    Very odd - see this screencast. http://www.zaowebdesign.com/cart_saved.swf

    It's working fine for me. Who are you hosted with? Are you aware of any persistent object cache in place?

  7. wpviking34536
    Posted 3 years ago #

    I do exactly what you have in the screencast, not working. I am hosted with GoDaddy, I just made changes to php5.ini. Could that be the problem?

  8. Justin Sainton
    Plugin Author

    Posted 3 years ago #

    That could indeed be part of the issue - especially if the settings have non-standard cookie/session locations or things like that.

  9. wpviking34536
    Posted 3 years ago #

    Ok, I'm not very skilled at that. Below is my php5.ini file, do you have any suggestions as what to change?

    register_globals = off
    allow_url_fopen = off
    memory_limit = 256M
    post_max_size = 10M
    file_uploads = On
    upload_max_filesize = 10M
    max_input_vars = 2000
    expose_php = Off
    max_input_time = 60
    variables_order = "EGPCS"
    extension_dir = ./
    upload_tmp_dir = /tmp
    precision = 12
    SMTP = relay-hosting.secureserver.net
    url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
    ; Only uncomment zend optimizer lines if your application requires Zend Optimizer support
    ; -- Be very careful to not to disable a function which might be needed!
    ; -- Uncomment the following lines to increase the security of your PHP site.
    ;disable_functions = "highlight_file,ini_alter,ini_restore,openlog,passthru,
    ;		      phpinfo, exec, system, dl, fsockopen, set_time_limit,
    ;                     popen, proc_open, proc_nice,shell_exec,show_source,symlink"
  10. Justin Sainton
    Plugin Author

    Posted 3 years ago #

    Yeah, I'm not sure that any of those modifications would have that effect on the site.

    Did you notice this working properly before the upgrade?

  11. wpviking34536
    Posted 3 years ago #

    Yes, I am also seeing that grid view is not working anymore either.

  12. webgen_sol
    Posted 3 years ago #

    Yes,This same prob me also have faced in my website .. But my client still want's.
    If I log out before completing the cart purchase then it should save it for next time I log in..

    WordPress Version 3.5.1
    plugin Version

    Any Idea's ..?
    Thanks For The Support.

  13. elaineerasmus
    Posted 3 years ago #


    Has anyone been able to solve this problem?
    My shopping cart items also gets deleted when logging out and then back in

  14. lanmangoo
    Posted 2 years ago #


    I have solved the problem :) In fact, I made a code that saves cart on server. Thus user can access his cart from anywhere.
    But you
    1) must be able to access your WP database,
    2) you should not to be afraid of looking at php :)

    Make table "custom_wp_wpsc_cart" (in your WP database) containing fields "user_ID" (bigint) and "wpsc_cart" (varchar as long as possible, for example 100000).
    Then copy this code at the begining of file plugins/wp-e-commerce/wpsc-theme/wpsc-cart_widget.php
    (If you don't use cart widget you could try to copy this at the begining of a file you use. I just haven't tried this code anywhere else, sorry).
    At the end of code you will find commented lines that refers to Save button - if you like to introduce one.
    Sorry if there's something strange or needless. But it works for me :)

    function find_cart() {
    	global $user_ID, $wpdb;
    	$get_cart = $wpdb->get_row("SELECT * FROM custom_wp_wpsc_cart WHERE user_ID = " . $user_ID);
    	$found_cart = unserialize($get_cart->wpsc_cart);
    	return $found_cart;
    function save_cart() {
    	global $wpsc_cart, $user_ID, $wpdb;
    	if ($is_cart) {
    			array('wpsc_cart' => $saved_cart),
    			array( 'user_ID' => $user_ID ),
    			array( '%d' )
    	else {
    			array('user_ID' => $user_ID,'wpsc_cart' => $saved_cart),
    	return $is_cart;
    global $wpsc_cart, $current_cart;
    if ($wpsc_cart && strpos(serialize($wpsc_cart),'sku') == false && (!isset($_POST['wpsc_ajax_action']) || isset($_POST['wpsc_ajax_action']) && $_POST['wpsc_ajax_action']!='empty_cart'))
    if ($_SESSION['current_cart)'] && $_SESSION['current_cart)']!=$wpsc_cart)
    //	{ save_cart(); }

    Put this code (to empty cart after checkout) in file plugins/wp-e-commerce/wpsc-includes/cart.class.php
    after line
    do_action('wpsc_save_cart_item', $cart_id, $this->product_id);

    // delete cart information from custom introduced db table
    global $user_ID;
    $wpdb->delete( 'custom_wp_wpsc_cart', array( 'user_ID' => $user_ID ), array( '%d' ) );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.