Skip to content

Commit 9278bd4

Browse files
pradeepkanakaPradeep Kanakasol-loup
authored
Fix inventory return value (#792)
Co-authored-by: Pradeep Kanaka <[email protected]> Co-authored-by: Paul Kang <[email protected]>
1 parent 64016fa commit 9278bd4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

app/code/Meta/Catalog/Model/Product/Feed/Builder/Inventory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ public function getAvailability(): string
117117
/**
118118
* Get available product qty
119119
*
120-
* @return int
120+
* @return int|float
121121
*/
122-
public function getInventory(): int
122+
public function getInventory()
123123
{
124124
if (!($this->product && $this->productStock)) {
125125
return 0;
@@ -130,6 +130,6 @@ public function getInventory(): int
130130
}
131131

132132
$outOfStockThreshold = $this->systemConfig->getOutOfStockThreshold($this->product->getStoreId());
133-
return (int)max($this->productStock->getQty() - $outOfStockThreshold, 0);
133+
return max($this->productStock->getQty() - $outOfStockThreshold, 0);
134134
}
135135
}

app/code/Meta/Catalog/Model/Product/Feed/Builder/InventoryInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getAvailability(): string;
4949
/**
5050
* Get inventory
5151
*
52-
* @return int
52+
* @return int|float
5353
*/
54-
public function getInventory(): int;
54+
public function getInventory();
5555
}

app/code/Meta/Catalog/Model/Product/Feed/Builder/MultiSourceInventory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ public function getAvailability(): string
256256
/**
257257
* Get available product qty
258258
*
259-
* @return int
259+
* @return int|float
260260
*/
261-
public function getInventory(): int
261+
public function getInventory()
262262
{
263263
if (!$this->product) {
264264
return 0;
@@ -269,7 +269,7 @@ public function getInventory(): int
269269
}
270270

271271
$outOfStockThreshold = $this->systemConfig->getOutOfStockThreshold($this->product->getStoreId());
272-
$quantityAvailableForCatalog = (int)$this->stockQty - $outOfStockThreshold;
272+
$quantityAvailableForCatalog = $this->stockQty - $outOfStockThreshold;
273273
return $quantityAvailableForCatalog > 0 ? $quantityAvailableForCatalog : 0;
274274
}
275275
}

0 commit comments

Comments
 (0)