3

When I go to advanced inventory and want to set Manage Stock to No I only have the option Yes available. But why? enter image description here

I have no idea where to start debugging any clue would be appreciated or maybe someone faced the same problem?

I already checked Stroes > Settings > Configuration > Catalog > Inventory settings and they look fine.

I don't know if it's related but how I found this bug was because a product I just created is apparently not salable and not listed in cataloginventory_stock_status table.

Update:
I figured out a bit more. The same problem affects Qty Uses Decimals too. In Magento_Ui/js/form/element/select::setOptions the following options are set for the selects Manage Stock, Qty Uses Decimals and Allow Multiple Boxes for Shipping:
enter image description here

this.optionsis set to the result of parseOptions() which gets data passed. In two of the cases the value 0 for label "No" is passed as integer and once as string. That's why parseOptions() will set the label to ' '.

The label is ' ' but the source code for the select then is <option data-title value="0"></option> can anyone explain this or has an idea why?
Does anyone know where the data for the options is passed to the select ui component?

2
  • 2
    Is it fresh M2 installation?
    – Sohel Rana
    Mar 21, 2019 at 13:07
  • No it is an already existing project. I checked it with an fresh install and there it works fine
    – Daniel
    Mar 21, 2019 at 13:08

1 Answer 1

1

Problem was completely on our side. We applied this core patch due to another issue we had. Problem with this patch is the simple compare ==. With a type compare === it works just fine again.

But I would be happy if someone could answer or update this answer to explain why sometimes the values are passed as strings and sometimes as integers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.