magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.3k forks source link

In Store Delivery sources show regardless of product stock status #37992

Open dtfdigital opened 1 year ago

dtfdigital commented 1 year ago

Preconditions and environment

Steps to reproduce

  1. Create new non-default "Stock" and set the sales channel as your website.
  2. Create 2 sources: Local, Warehouse.
  3. Set Local source as an active pickup location and fill out the fields pertaining to this (address, latlong etc)
  4. Assign these sources to the non-default stock.
  5. Ensure that the distance settings / api key etc are set correctly so that pickup locations can show on the frontend.
  6. Create a product, and assign the Local, and Warehouse sources. Set the stock level on Local as 0 (out of stock) and warehouse as 5 (in stock).
  7. On the frontend, add the product to cart and proceed through the checkout.
  8. Select the pick in store option.

Expected result

As the product is out of stock for the Local stock source, the store pickup location for this should not appear (or show as unavailable).

Actual result

The store pickup location for the Local stock source shows as available.

Additional information

In order to resolve the issue the product needs to be removed from the Local stock source when out of stock which negates the point of having the out of stock status on these?

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @dpdesignthatfits. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

dtfdigital commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @dpdesignthatfits. Thank you for your request. I'm working on Magento instance for you.

m2-assistant[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

magento-deployment-service[bot] commented 1 year ago

Hi @dpdesignthatfits, here is your Magento Instance: https://f68cfe99b48eaa7068588a58c0553713.instances-prod.magento-community.engineering Admin access: https://f68cfe99b48eaa7068588a58c0553713.instances-prod.magento-community.engineering/admin_484e Login: 939ee968 Password: 8d47707719c0

dtfdigital commented 1 year ago

@engcom-Bravo Tested and confirmed reproducible on the develop instance. Can you add label for us?

Area: Inventory Reproduced on 2.4.x Issue: Confirmed

engcom-Bravo commented 1 year ago

Hi @dpdesignthatfits,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

Steps to reproduce

Screenshot 2023-09-15 at 4 28 50 PM Screenshot 2023-09-15 at 3 15 39 PM

Since the product is in out of stock for Local source the store pickup location should not be available but still it is displaying.

Hence Confirming the issue.

Thanks.

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9561 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

devendra-nulogic commented 9 months ago

I have created a patch to fix this issue

diff --git a/vendor/magento/module-inventory-in-store-pickup/Model/ResourceModel/GetPickupLocationIntersectionForSkus.php b/vendor/magento/module-inventory-in-store-pickup/Model/ResourceModel/GetPickupLocationIntersectionForSkus.php
index 3f5e11d..d561416 100644
--- a/vendor/magento/module-inventory-in-store-pickup/Model/ResourceModel/GetPickupLocationIntersectionForSkus.php
+++ b/vendor/magento/module-inventory-in-store-pickup/Model/ResourceModel/GetPickupLocationIntersectionForSkus.php
@@ -70,6 +70,7 @@ class GetPickupLocationIntersectionForSkus
                 $this->sourceResource->getMainTable() . '.' . SourceInterface::SOURCE_CODE
             )
             ->where(SourceItemInterface::SKU . ' in (?) ', $skus)
+            ->where(SourceItemInterface::STATUS . ' = 1')
             ->where(SourceInterface::ENABLED . ' = 1')
             ->where(PickupLocationInterface::IS_PICKUP_LOCATION_ACTIVE . ' = 1')
             ->reset(Select::COLUMNS)
miller75 commented 8 months ago

Any update on this, @devendra-nulogic fix works if you only have one pickup location