Skip to content

Commit

Permalink
Fix Ryman's OOS push issue to avoid recommendation (EC-50) (#44)
Browse files Browse the repository at this point in the history
Fix Ryman's OOS push issue to avoid recommendation (EC-50)
  • Loading branch information
rushabhsha authored Feb 20, 2023
1 parent 9902983 commit e45114c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/code/Ometria/AbandonedCarts/etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Ometria_AbandonedCarts" setup_version="2.5.1"/>
<module name="Ometria_AbandonedCarts" setup_version="2.6.0"/>
</config>
2 changes: 1 addition & 1 deletion app/code/Ometria/Api/etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Ometria_Api" setup_version="2.5.1"/>
<module name="Ometria_Api" setup_version="2.6.0"/>
</config>
20 changes: 8 additions & 12 deletions app/code/Ometria/Core/Plugin/OrderManagementPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,20 @@ private function sendPushNotifications(OrderInterface $order)
}

foreach ($order->getItems() as $orderItem) {
// Retrieve the salable qty of the product based on configured scope
// Retrieve the salable qty of the product based on configured scope and after placing an order
$salableQty = $this->getSalableQty(
$orderItem->getProduct(),
$stockPushScope
);

// if salable qty is set and not already 0, check if push is required (null infers manage stock is disabled)
if ($salableQty !== null && $salableQty > 0) {
// Calculate new salabale quantity (after order placement)
$salableQtyAfterOrder = $salableQty - $orderItem->getQtyOrdered();
if ($salableQtyAfterOrder <= 0) {
$stockData = $this->inventoryService->getPushApiStockData(
(int)$orderItem->getProductId(),
false
);
// if salable qty is set to 0, then push the is_in_stock to false (null infers manage stock is disabled)
if ($salableQty !== null && $salableQty == 0) {
$stockData = $this->inventoryService->getPushApiStockData(
(int)$orderItem->getProductId(),
false
);

$this->pushApiService->pushRequest($stockData);
}
$this->pushApiService->pushRequest($stockData);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Ometria/Core/etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Ometria_Core" setup_version="2.5.1"/>
<module name="Ometria_Core" setup_version="2.6.0"/>
</config>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ometria/magento2",
"type": "magento2-module",
"version": "2.5.1",
"version": "2.6.0",
"description": "Dev composer package for Ometria Extension",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e45114c

Please sign in to comment.