Support » Plugin: Checkout with Vipps for WooCommerce » Cart is empty after go back or cancel from Vipps page

  • Normally the cart should not be cleared if payment does not succeed?

    Right now, when we go to pay with Vipps then go back or cancel it. Cart is empty.

    This is just happening to me or something wrong?

    Thanks.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author iverok

    (@iverok)

    Is this with the latest version? This was an earlier bug that ought to have been fixed now.

    Thread Starter l2aelba

    (@l2aelba)

    Hi, its version 1.0.5

    Plugin Author iverok

    (@iverok)

    Could you try 1.0.7 first, released today? If you still have issues, we are probably going to rewrite this bit to be more robust, but it interacts with an Upcoming Feature, so it will be a little while until it’s there.

    still having similar bug. any fix for it?

    using version 1.1.11 .

    Plugin Author iverok

    (@iverok)

    The code that deleted the cart was removed months ago, could you please state explicitly and exactly the steps needed to reproduce this?

    The only situation where the cart is currently deleted and then restored is when you have a cart with products but then use the express checkout feature on a single product. The old cart is then saved and restored only successful purchases. Even then the cart shouldn’t be deleted on payment cancel – I’ve just tested this.

    If you *start* the process in a different browser, such as the Facebook embedded browser, you may still be redirected to the system browser on payment cancel/complete. In that case, you session, including the cart, will be lost.

    Sorry for hijacking, but I think this is related. If i currently click cancel on the payment page for vipps, the cart is deleted. Happens in 1.1.12.

    Plugin Author iverok

    (@iverok)

    Is this using express checkout or the normal checkout process?

    If using express checkout, is the cart empty when you go to Vipps, or are there elements in the cart?

    The only code that currently does anything with the cart saves the current cart if you go to express checkout for a single product and the cart isn’t empty. This code restores that original cart on a successful purchase. Otherwise the cart management is left to standard WooCommerce, in which it is only emptied on successful purchase.

    I have tried to replicate this by using express checkout for single products, express checkout on the cart page and the standard Woo checkout page and in all these cases the cart is left as it is.

    It’s not using express checkout no.

    Session is wiped, what are you calling when a user clicks cancel?
    I have a plugin written to work with woocommerce for single product, maybe it’s something to do with that but I am also using it with dibs which this does not happen with. Only time cart is cleared is on woocommerce_add_to_cart_validation, because it needs to clear the cart if a product get’s added, but that’s way before checkout.

    Plugin Author iverok

    (@iverok)

    Both “cancel” and success goes to the same page, handled by “vipps_wait_for_payment” in the Vipps object.

    This page assumes the session exists and gets the pending orders’ orderid from the session. Because it is possible to be sent back from the Vipps app to another browser (for example, from the Facebook app -> Vipps app -> return to system browser), it does check if the session exists and if not it will create a new one. In that case the cart will be lost.

    If something else blocks or wipes your session cookie, this will happen the same way.

    The only other thing that does anything with the cart is “maybe_restore_cart” which is called from the “thankyou”-event – it only runs for express checkout orders, and only on successful return.

    Otherwise, nothing is done with the session or the cart.

    Strange, because only time this happens is with vipps. Guess I need to set up a clean installation and test some more.

    Thank you for quick reply!

    Plugin Author iverok

    (@iverok)

    Just to be 100% sure: Are you ending up in the same browser that you started the transaction in after going to the Vipps app?

    Yes, it does not redirect back to checkout because by then the cart is already emptied (I think) so I have a redirect from checkout on empty cart to products page, which is where I wind up if i hit cancel.

    Hmm, I was wrong. I think maybe I have some template issues, the url that it is returning me to is:

    https://site.com/vipps-betaling/?t=50fde90788961826070a9c39d4ce2f760f131hkj01e87041f2fc991kljlkjb924

    Also, in the backend on the order the following message:

    Bestilling mislyktes eller ble avvist hos Vipps Ordrestatus endret fra Avventer betaling til Kansellert.

    I think that whenever a user has reached so far in the process but hit cancel it’s because he/she wants to select another payment option, is it then wise to cancel the order?

    • This reply was modified 2 years, 9 months ago by jonkristian.
    • This reply was modified 2 years, 9 months ago by jonkristian.
    Plugin Author iverok

    (@iverok)

    Yes, that’s the return URL which is handled in Vipps.class.php by the wait_for_payment.

    It requires that the session exists, but if it doesn’t it will still be able to get the correct order (and find out that its status is ‘cancelled’). So in that case, the cart will be missing, but it should normally only happen if you switch browsers or your cookies get zapped.

    I disabled my plugin and switched to the Twenty Nineteen theme but the same thing happens, redirected to a page where it says order cancelled… Pretty sure I’m hitting line 1634 in Vipps.class.php.

    But going back to checkout page manually everything is there, so cart is not cleared. Is the user normally not sent back to checkout when he/she hits cancel?

    • This reply was modified 2 years, 9 months ago by jonkristian.
    • This reply was modified 2 years, 9 months ago by jonkristian.
Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Cart is empty after go back or cancel from Vipps page’ is closed to new replies.