Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Out of stock product in cart causes problems, unable to update cart after this #3873

Open
jornwildenbeest opened this issue Jan 31, 2025 · 7 comments
Assignees
Labels
bug commerce4 Issues related to Commerce v4 Craft Commerce Fixed

Comments

@jornwildenbeest
Copy link

What happened?

Description

When having a product in your cart that went out of stock, while you had it in your cart, it causes problems.
When you try to add another product to your cart, it always returns the "“{description}” is currently out of stock." and not adding the product o your cart.

Same goes for editing other line items in your cart, let's say you want to change the qty or delete another product, it is not possible because of this one product that is out of stock.

Steps to reproduce

  1. Add multiple products to your active cart.
  2. reduce the stock of 1 product to 0 through the control panel.
  3. Try adding another product to your cart through a product detail page for example

Expected behavior

  1. The product still gets added to you cart.

Actual behavior

You get an error that it is not possible to update your cart because that product is currently out of stock, but this is far from user friendly.

Craft CMS version

4.13.9

Craft Commerce version

4.7.2

PHP version

8.1

Operating system and version

Mac OS

Database type and version

Mysql 8

Image driver and version

No response

Installed plugins and versions

@jornwildenbeest jornwildenbeest added bug commerce4 Issues related to Commerce v4 Craft Commerce labels Jan 31, 2025
@lukeholder
Copy link
Member

@jornwildenbeest can you confirm this is also an issue on Craft Commerce 4.8?

The item that became out of stock should be removed from the cart and a notice placed on the order that it was removed due to being out of stock.

If 4.8 doesn't fix it could you email your database backup, composer.json, composer.lock to [email protected] and reference this issue to us in support so we have context.

Let us know the order number the issue is occurring on and we will try to reproduce.

Thanks.

@lukeholder
Copy link
Member

@jornwildenbeest I was able to reproduce now!

I have a potential fix here: #3878

But will need to do some more testing as it is a change in the way we recalculate the cart.

I will update you here once we finalize on a solution.

@lukeholder lukeholder self-assigned this Feb 3, 2025
@lukeholder
Copy link
Member

We have merged that PR to fix this, to be included in the next release.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "4.x-dev as 4.8.0.1",
  "...": "..."
}

Then run composer update, and then let us know how you go.

We will update this ticket once the release is out.

@nfourtythree
Copy link
Contributor

Hi

This fix has been released in Commerce 4.8.1 which is out now.

Thanks!

@nfourtythree
Copy link
Contributor

The fix has also been included in Commerce 5.3.2 which has been released.

Thanks!

@lukeholder
Copy link
Member

We have had to revert this fix in 5.3.2.1 and 4.8.1.1 due to it causing other issues.

We will look into it more this week.

@lukeholder lukeholder reopened this Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4 Craft Commerce Fixed
Projects
None yet
Development

No branches or pull requests

3 participants