Problem/Motivation

As the title says. When using inline entity form to edit variations, updating the stock, clicking "Update variation" and then opening it again, the previously set value gets lost.

Steps to reproduce

Proposed resolution

Use $items->adjustment as the default value

Remaining tasks

I only tested with the Simple stock transaction widgtet, others will need different fixes.

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Berdir created an issue. See original summary.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new1 KB
berdir’s picture

Ooops, wrong patch.

luksak’s picture

Status: Needs review » Reviewed & tested by the community

Works for me. Thanks!

luksak’s picture

This stopped working in a recent update I installed.

What is missing to get this committed?

luksak’s picture

Status: Reviewed & tested by the community » Needs work

sourabhjain made their first commit to this issue’s fork.

sourabhjain’s picture

Status: Needs work » Needs review

@lukas could you please review MR 15 and let me know if you still facing this issue.

luksak’s picture

Status: Needs review » Needs work

@sourabhjain Nope, no luck sadly.

berdir’s picture

Status: Needs work » Reviewed & tested by the community

That was a misunderstanding, it was mixed up with #3309574: Field widget doesn't allow to set initial stock level if purchasable entity hasn't been created, this still fixes the problem it's meant to fix.

guy_schneerson’s picture

Status: Reviewed & tested by the community » Needs work

Hi all and thanks for your attention to this.
The proposed change does not consider all the permutations of the Stock Level Widget. I assume you are all using the "Absolute stock level" and looks to me like the patch will make the use of the "Simple Stock transaction" even more confusing.
I personally discourage the use of the inline for use with stock, but if a good solution that works for all cases is proposed I will be happy to commit it.

alfthecat’s picture

Tried the patch from the MR and unfortunately, no luck either.

In my case, unfortunately, it's just not an option to have users edit their variations one-by-one after they've been created on the fly via IEF during product creation.

It looks like I have to abandon commerce_stock for this reason, so I'm thinking to replicate the features of commerce_stock by simply using ECK to create a "Stock location" entity and a "Stock transaction" entity, as well as a hidden "Stock level" field on the variation entity, and have ECA update stock levels on checkout completion and on returns.

I was hoping I could leave commerce stock enabled and have ECA set the value for "always in stock" to "on" (not possible to set a default value for the boolean), then hide it from the UI and have ECA flip it to "off" when the stock level field reaches 0. I was hoping we would then still have the "Out of stock" button behavior commerce_stock provides. Except, when I try this, variations that have "Always in stock" flipped On, they still show as out of stock in the front-end. When I change the default service to "Always in stock" and I flip the boolean off, the product still shows as being in stock so that doesn't work either.