magento / magento/inventory

Back Order customer notification does not show

Open
#3,297 3 comments 0 reactions 1 assignee View on GitHub

@andrewbess is already working on this.

Since Apr 29, 2021.

Progress: dev in progress
Dominant language
PHP
Stars
357
Forks
262
PR merge metrics
No merged PRs in 30d

Description

### Preconditions (*)

Magento 2.4.1
MSI

### Steps to reproduce (*)

1. Create a product, add to source
2. Put QTY as -1 and Out of Stock Threshold as whatever you want (i.e. -20)
3. Add one to cart
4. Go to checkout page or cart page

### Expected result (*)

1. A message displays that says "We don't have as many quantity as you requested, but we'll back order the remaining ___"

### Actual result (*)

1. No message is displayed.

It seems that https://github.com/magento/inventory/pull/3143 created by @arnobsh broke backorder messaging in some cases. It doesn't take into account $stockItemData, and thus if the stock item qty is -1 and out of stock threshold is -20, it ends up with displayQty = 0, and thus doesn't display a backorder message. Salable Quantity is > 0, but stock available data is < 0 and thus should be displaying the stock available data's number as backorder number.
![image](https://user-images.githubusercontent.com/34324129/110497034-18072980-80c4-11eb-8dca-f3d9060b83ba.png)
![image](https://user-images.githubusercontent.com/34324129/110497541-89df7300-80c4-11eb-9b3b-ae6f8bfed855.png)
![image](https://user-images.githubusercontent.com/34324129/110497665-aaa7c880-80c4-11eb-9da2-fad9ab161e7d.png)

My suggestion would be to add
```
if ($backOrderQty < 0 && $requestedQty < $salableQty) {
$displayQty = $requestedQty;
}
```

to getDisplayQty

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.