co-cart / co-cart

đź›’ CoCart is a free REST API designed to decouple your slow WooCommerce storefront and convert it blazing-fast, build in any web framework, and save you countless hours.

Home Page:https://cocartapi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[v3.1+] Cart not appearing once cart loaded from session

samimakela opened this issue · comments

Describe the bug

Using cocart-load-cart URL parameter does not load cart contents, but empties cart entirely. Worked perfectly with version 3.0.17, but after upgrading to 3.1.1, problem appeared immediately.

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest trunk branch of CoCart on GitHub (this is not the same version as on WordPress.org!)
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional)
  • I have installed the requirements to run this plugin.

Steps to reproduce the issue

  1. Add items to cart via rest api without authentication
  2. Use returned cart key as url parameter with WooCommerce cart url

Expected/actual behaviour

Expected cart items to be loaded, but instead an empty cart is shown.

Isolating the problem

  • This bug happens with only WooCommerce and CoCart plugin are active.
  • This bug happens with a default WordPress theme active.
  • This bug happens with the WordPress theme Storefront active.
  • This bug happens with the latest release of WooCommerce active.
  • This bug happens only when I authenticate as a customer.
  • This bug happens only when I authenticate as administrator.
  • I can reproduce this bug consistently using the steps above.

@samimakela Thank you for reporting the error. I couldn't understand why this was happening but it appears the totals can't be calculated once the session has loaded. It doesn't destroy the cart but for some odd reason it prevents the cart from appearing.

A patch will be pushed shortly.