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

Remove erronious check #3352

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

RikvdHeijden
Copy link

Description (*)

The isUseConfigManageStock variable only describes whether or not the stockItemConfiguration uses the default config value or the stockItemConfiguration specific config value for this the isManageStock value. It does not say anything about the value of the manage_stock setting. Since this logic is already correctly implemented in the getManageStock function this line can be completely removed.

Fixed Issues (if relevant)

As it was the line causes a bug where every PUT call to /products/{sku}/stockItems/{stock_item} endpoint with a use_config_manage_stock value of false will always cause that stockItem to register as in_stock until a reindex is run.

Manual testing scenarios (*)

Previous behavior:

  1. Send a PUT request to the /products/{sku}/stockItems/{stock_item} endpoint with is_in_stock false and use_config_manage_stock false
  2. The is_salable value in the inventory_stock_{stock_item} view is 1 where it should be 0
  3. Trigger a reindex
  4. The is_salable value now reads 1

Correct behavior

  1. Send a PUT request to the /products/{sku}/stockItems/{stock_item} endpoint with is_in_stock false and use_config_manage_stock false
  2. The is_salable value in the inventory_stock_{stock_item} view is 0

Questions or comments

As it is right now this call will still set products in_stock when Manage stock is disabled. I don't know enough about that workflow to determine if that is the correct behavior.

Contribution checklist (*)

  • [x ] Pull request has a meaningful description of its purpose
  • [x ] All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

The isUseConfigManageStock variable only describes whether or not the stockItemConfiguration uses the default config value or the stockItemConfiguration specific config value for this the isManageStock value. It does not say anything about the value of the manage_stock setting. Since this logic is already correctly implemented in the getManageStock function this line can be completely removed.

As it was the line causes a bug where every PUT call to /products/{sku}/stockItems/{stock_item} endpoint with a use_config_manage_stock value of false will always cause that stockItem to register as in_stock until a reindex is run.

As it is right now this call will still set products in_stock when Manage stock is disabled. I don't know enough about that workflow to determine if that is the correct behavior.
@RikvdHeijden
Copy link
Author

Sadly I did not have the time to write you accompanying tests. I hope this isn't too big of an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant