commerce icon indicating copy to clipboard operation
commerce copied to clipboard

[4.x]: Can not add new items to an active cart

Open hatyi opened this issue 2 years ago • 0 comments

What happened?

Description

I have updated to commerce 4.3.3 and for some reason I can not add new items to an existing cart. When I roll back to 4.3.2 the functionality is restored, works again as before.

The error occurs on my local docker based environemnt and on a staging site as well using different system components. I don't see any kind of relevant error in the logs.

Steps to reproduce

1.I'm submitting an HTML form using POST to the commerce/cart/update-cart action

Expected behavior

Item gets added to the existing / active cart

Actual behavior

System creates a new cart for every form submit.

If I go to the cart page craft.commerce.carts.cart.lineItems returns an empty array.

In the admin I'm seeing new active carts being created for each form submit.

The CMS and Commerce versions I'm listing below (and what you can see in the first attached composer.json file) is the last working configuration, you need to update to 4.3.3 to be able replicate the error. Edit: I've also attached a composer.json file I had to rollback from today.

Craft CMS version

4.5.14

Craft Commerce version

4.3.2

PHP version

8.1.18

Operating system and version

Linux 06e4a602fd6f 6.5.0-14-generic #14~22.04.1-Ubuntu

Database type and version

mysql:8.0.30

Image driver and version

No response

Installed plugins and versions

This configuration works composer.json

This doesn't work for example composer.json

staging server Linux 990310.cloudwaysapps.com 4.19.0-22-cloud-amd64 #1 SMP Debian 4.19.260-1 (2022-09-29) x86_64 GNU/Linux PHP 8.1.27 (cli) (built: Dec 21 2023 20:20:21) (NTS) mysql Ver 15.1 Distrib 10.4.20-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

local environment Linux 06e4a602fd6f 6.5.0-14-generic #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 x86_64 GNU/Linux PHP 8.1.18 (cli) (built: Apr 14 2023 18:18:41) (NTS) mysql Ver 8.0.30 for Linux on x86_64 (MySQL Community Server - GPL)

hatyi avatar Jan 17 '24 10:01 hatyi