Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kieckhafer
Copy link
Member

@kieckhafer kieckhafer commented Jan 22, 2019

Impact: breaking|minor
Type: refactor

Issue

A recent update to how we calculate inventory added a new field, inventoryAvailalbeToSell. This left us with two inventory fields, inventoryAvailalbeToSell and inventoryQuantity, in the Products collection.

In the Catalog collection, we renamed inventoryQuantity to inventoryInStock, as it was a better description of what the field actually is.

We initially left the Products collection alone, but feel like we should keep these field names in sync to avoid confusion.

Solution

Rename the field inventoryQuantity to inventoryInStock in the Products collection.

Breaking changes

No breaking changes in Reaction code. If you use the inventoryQuantity field in any custom code, it will need to be updated.

Testing

  1. Create orders with various amounts of products, and see that inventory correctly increments / decrements
  2. See that Sold Out, Low Inventory badges work as they were

@kieckhafer kieckhafer requested a review from aldeed January 22, 2019 21:13
canBackorder: canBackorder(variantOptions),
inventoryAvailableToSell: variant.inventoryAvailableToSell || 0,
inventoryInStock: variant.inventoryQuantity || 0,
inventoryInStock: variant.inventoryInStock || 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be the time to correct this, but inventoryInStock and inventoryAvailableToSell are optional in the catalog GraphQL schema, and it seems to me that null would mean something different from 0. If inventory isn't tracked in the product (null) but yet that becomes 0 in the catalog, that seems to be changing the meaning from "unknown" to "none".

So essentially I'm proposing that we remove the || 0 from all of these

@kieckhafer kieckhafer force-pushed the refactor-kieckhafer-renameInventoryQuantity branch from bc1e3fd to e039447 Compare January 22, 2019 23:24
@kieckhafer
Copy link
Member Author

@aldeed can this be merged?

@aldeed aldeed merged commit 831c381 into develop Jan 23, 2019
@aldeed aldeed deleted the refactor-kieckhafer-renameInventoryQuantity branch January 23, 2019 15:46
@jeffcorpuz jeffcorpuz mentioned this pull request Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants