Skip to content

Add new service for InventorySalesAPI intended to be used to check whether customer can buy or put to Shopping Cart needed amount of product #520

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

Closed
maghamed opened this issue Feb 7, 2018 · 1 comment
Assignees

Comments

@maghamed
Copy link
Contributor

maghamed commented Feb 7, 2018

Currently, we have two services

  • IsProductSalable (checks whether product salable or not for the particular stock)
  • GetProductSalableQty (returns the salable quantity of product assigned to the particular stock)

in the scope of the current ticket, we need to add new service

  • IsProductSalableForRequestedQty::execute(string $sku, int $stockId, float $requestedQty): boolean
    Idea behind this service is to apply all the Inventory configuration/restrictions etc to determine whether we can sell the amount Customer wants to buy.

it’s not just GetProductSalableQtyInterface() > $requestedQty (which we do now).

Because there could be - Can manage Stock = 0 (in this case we no need to care about Stock Qty at all, for example, for Downloadable product)
or, Min Salable Qty = 40. And even having 30 items in stock we still can’t sell it to Customer, because we sell starting from 40 items (just wholesales allowed).
Or, if we have Backorder enabled and could sell even more than we have in stock
that’s why - all that should be the responsibility of IsProductSalableForRequestedQty(string $sku, int $stockId, float $requestedQty) service.
We will use it as a check when customer puts the product into the shopping cart

These three services

  • IsProductSalable
  • getProductSalableQty
  • IsProductSalableForRequestedQty
    should be placed into InventorySalesApi module.
    And all these service are related to salability of the product , but not availability , because we could have some products in our warehouse which occupy space and available at the same time, but because of configuration (we sell just for wholesales) we can’t sell it to retail customers
@naydav
Copy link

naydav commented Feb 23, 2018

First Prototype
#373

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

No branches or pull requests

4 participants