commerce icon indicating copy to clipboard operation
commerce copied to clipboard

[5.x]: Stock does not save the first time after creating new product variant

Open WHITE-developer opened this issue 1 year ago • 5 comments

What happened?

Description

When creating a new product variant and directly adding stock to it. It does not save the stock the first time.

Steps to reproduce

  1. Go to a product
  2. Click on 'New Product variant'
  3. Turn on the 'Inventory' switch and directly set the stock to 1
  4. Click on 'Create product variant'
  5. There are now changes made in the product entry, so click on 'Save and continue editing'
  6. After the reload, the stock of the newly created variant is back to 0 again.

Expected behavior

The stock in the newly created variant is saved correctly

Actual behavior

Craft CMS version

5.3.4

Craft Commerce version

5.0.16.1

PHP version

8.3.8

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

WHITE-developer avatar Sep 06 '24 11:09 WHITE-developer

@WHITE-developer can you please confirm this is also happening on the latest release of Commerce 5.1.x ?

lukeholder avatar Sep 09 '24 06:09 lukeholder

Hi @lukeholder, thank you for your reply. It looks good in Commerce 5.1.x.

WHITE-developer avatar Sep 17 '24 07:09 WHITE-developer

Hi @lukeholder, we checked again and it isn't fixed in the current 5.1.x versions.

We updated to commerce 5.1.3. We created a new product variant and added stock directly to it. The stock was not saved the first time.

WHITE-developer avatar Oct 09 '24 13:10 WHITE-developer

Some extra info, Product revisions are disabled, When first creating the variant, and its still a draft the inventory is saved and also visible in the inventory overview and database, but after saving the product itself the inventory item is removed.

white-lukas avatar Oct 11 '24 07:10 white-lukas

I cant reproduce this in any latest release of Commerce 5.x and think it was fixed.

Please raise a new issue if the problem persists. Thanks.

lukeholder avatar Jan 28 '25 03:01 lukeholder