What this solution does
The module adds a delivery restriction rule that verifies whether all items in the cart are available on a single selected warehouse. If any item is missing in the required quantity at the warehouse, the delivery method becomes unavailable for the order.
The module integrates with the OnSaleComponentOrderJsData and OnSaleComponentOrderDeliveriesCalculated events. This enables dynamic updates to the list of available delivery methods and displays notifications to the user.
During delivery calculation, the system analyzes the cart contents and the quantity of each item. It then checks stock availability at the warehouses specified in the restriction rule settings. If all items are available in the required quantities at any warehouse from the list, the delivery method is activated. If items are available only at a subset of warehouses, the system keeps only those options active and hides the rest, displaying an appropriate message to the user.
The module checks for the availability of all order items at a single warehouse. If the required items are missing from all selected warehouses, delivery becomes unavailable, and an error message is displayed to the user.
The technical implementation relies on the class \Awz\Dlvronestore\AwzCheckOneStoreDeliveryRestrictions, which extends Bitrix\Sale\Delivery\Restrictions\Base. The core validation logic is implemented in the check() method. Integration with the checkout component is handled via event handlers in the Handlers class.
The module has no separate settings in the administration panel. Configuration is performed through the Bitrix interface: within a delivery profile, navigate to the 'Restrictions' section, add a rule named 'By availability of all items at one warehouse', and configure its parameters.
Rule parameters:
Message for unavailable delivery: text displayed to the user if none of the warehouses have all order items.
Message for unavailable delivery at some warehouses: text displayed if items are available only at some of the warehouses.
Warehouses to check: list of warehouses where stock availability will be verified. Multiple warehouses can be selected.
General iT can install and configure this module and check how it works on your website.