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

Introduce "suppliable" scope to represent any variant which can_supply?(1) #2536

Merged
merged 3 commits into from
Feb 1, 2018

Conversation

jhawthorn
Copy link
Contributor

Previously when using the API to query variants, we could only restrict by variants which were in_stock, which meant any variant which either does not track inventory or has a count_on_hand > 0.

In the admin we were using the in_stock scope, which made it impossible to add out of stock but backorderable products to the cart, despite them being possible to add on the frontend (See #2522).

This PR creates a new "suppliable" scope, which returns all variants which are in stock, backorderable, or don't have their inventory tracked. It also adds support to the API variants route to query using this scope and changes to admin variant selectors to query this instead.

Fixes #2522

Copy link
Member

@gmacdougall gmacdougall left a comment

Choose a reason for hiding this comment

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

Big fan of this. Thanks John!

@jhawthorn jhawthorn merged commit dda02ec into solidusio:master Feb 1, 2018
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.

2 participants