Stock adjustment gets lost when collapsing and reopening variation in inline entity widget

Created on 10 November 2022, about 2 years ago
Updated 12 January 2024, 12 months ago

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

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇨🇭Switzerland berdir Switzerland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇭Switzerland Lukas von Blarer

    This stopped working in a recent update I installed.

    What is missing to get this committed?

  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India sourabhjain

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

  • Status changed to Needs work about 1 year ago
  • 🇨🇭Switzerland Lukas von Blarer

    @sourabhjain Nope, no luck sadly.

  • Status changed to RTBC about 1 year ago
  • 🇨🇭Switzerland berdir Switzerland

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

  • Status changed to Needs work about 1 year ago
  • 🇬🇧United Kingdom guy_schneerson

    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.

  • 🇹🇭Thailand AlfTheCat

    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.

Production build 0.71.5 2024