• Hello,
    I don’t need the cart widget in my site since the “Buy now” button and the Paypal merchant will send customers directly to the checkout screen.
    I managed to make the final cart checkout screen mandatory, in order to let people adjust the item quantity.

    Now, when dealing with limited stock, I need to get the reserved/processed quantity back available as soon as possible, so I’m trying to empty the cart each time the user leaves the checkout page instead of proceeding with the order.

    I’ve tried to add

    function action_empty_cart(){
    global $wpdb, $wpsc_cart;
    $wpsc_cart->empty_cart( false );
    }
    if ( !isset( $_REQUEST['wpsc_update_quantity'] ) && !isset( $_REQUEST['wpsc_action'] ) ) {
    add_action( 'init', 'action_empty_cart' );
    }

    But, while it does work when submitting the “Buy now” form, it doesn’t hold the item when simply updating the quantity, and the cart is left empty, as if the $_REQUEST[‘wpsc_update_quantity’] was not set.
    Although further checking (by echo) shows on the contrary that actually it is, the exactly opposite condition is anyway getting parsed.

    In my opinion, evidence suggests that the “init” action hook occurs two times: one of them (inexplicably) misses the variable and then the cart gets emptied by mistake.
    Using another action hook could be a possible workaround?

    I would really appreciate your help.
    Any idea?

    http://wordpress.org/extend/plugins/wp-e-commerce/

Viewing 1 replies (of 1 total)
  • Thread Starter 3dolab

    (@3dolab)

    Why is the init hook invoked multiple times

    I was able to track the requests through Firebug and it reports no 404s, but just a couple of index.php?wpsc_user_dynamic_css=true… and index.php?wpsc_user_dynamic_js=true…

    However, considering these variables is still not enough: Live HTTP Headers detects a connection to the site root (the referrer is the cart page) as the very last thing that gets loaded.
    That’s the culprit, but I don’t know where it comes from.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP e-Commerce] Emptying the cart’ is closed to new replies.