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

@maghamed

Description

@maghamed

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions