[Plugin: WP e-Commerce] Emptying the cart
-
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?
- The topic ‘[Plugin: WP e-Commerce] Emptying the cart’ is closed to new replies.