Adding a second item to cart removes the first


06 Apr, 2012 12:43 PM via web

I've used Jigshop for a photographer's website. If there is an item in the cart and a second product is added, the first item gets removed. Anyone have any ideas? The client is going absolutely mental over this.

  1. 2 Posted by chriscct7 on 06 Apr, 2012 12:47 PM

    chriscct7's Avatar

    URL please?


  2. 3 Posted by lwdigitaldesign on 06 Apr, 2012 12:48 PM

  3. 4 Posted by lwdigitaldesign on 06 Apr, 2012 12:50 PM

    Sorry forgot to paste in the two test products:

  4. 5 Posted by chriscct7 on 06 Apr, 2012 04:18 PM

    chriscct7's Avatar

    I tried it, and it works for me in Chrome.


  5. 6 Posted by vanbo on 07 Apr, 2012 10:48 AM

    Hi lwdigitaldesign,

    This seems to appear because when the cart is created it is ordered as an array of 0,1,2 ..., but when an item is removed it does not reorder itself (exp: remove item 1 the cart is left with 0,2). I would say this is a Jigoshop bug.

    If you want a workaround until its fixed you can reorder the cart items in the get_cart_from_session function. Like this (I tried it and it works, but you should test it for yourself too)

           $order_key = 0; 
            foreach ($cart as $key => $values) :
                if ($values['data']->exists() && $values['quantity'] > 0) :
                    self::$cart_contents[$order_key] = array(
                        'product_id'    => $values['product_id'],
                        'variation_id'  => $values['variation_id'],
                        'variation'     => $values['variation'],
                        'quantity'      => $values['quantity'],
                        'data'          => $values['data']

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

What is fifteen divided by three?

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.