承接 scriptbaker/magento2-ship-out-of-stock-items 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

scriptbaker/magento2-ship-out-of-stock-items

Composer 安装命令:

composer require scriptbaker/magento2-ship-out-of-stock-items

包简介

This Magento 2 module allows the creation of shipments for orders containing items that are out of stock. In default Magento, attempting to create a shipment for an order with out-of-stock items results in the error: "Not all of your products are available in the requested quantity." This module rem

README 文档

README

Overview

The Scriptbaker_ShipOutOfStockItems module for Magento 2 allows the creation of shipments for orders containing items that are out of stock. In default Magento, attempting to create a shipment for an order with out-of-stock items results in the error: "Not all of your products are available in the requested quantity." This module remedies that problem by adjusting the stock quantities to ensure the shipment can be processed.

Features

  • Enables shipment creation for out-of-stock items.
  • Automatically adjusts stock quantities to allow for shipment processing.
  • Seamlessly integrates with Magento's Multi-Source Inventory (MSI) system.

Installation

  1. Download the Module: Download the module package or clone the repository into the app/code/Scriptbaker/ShipOutOfStockItems directory.

  2. Enable the Module:

    bin/magento module:enable Scriptbaker_ShipOutOfStockItems
  3. Run Setup Upgrade:

    bin/magento setup:upgrade
  4. Clear Cache:

    bin/magento cache:clean

Usage

Once the module is installed and enabled, it will automatically adjust stock quantities to allow for the creation of shipments for out-of-stock items. No additional configuration is necessary.

Implementation Details

The module listens to two key events and adjusts the stock quantities accordingly:

  1. sales_order_shipment_save_before:
    • Adjusts stock quantities before the shipment is created to ensure it can be processed without errors.
  2. sales_order_shipment_save_after:
    • Updates stock quantities after the shipment is saved to reflect the accurate inventory levels.

Files Included

  • registration.php: Registers the module with Magento.
  • etc/module.xml: Declares the module and its version.
  • etc/events.xml: Registers the observers for the sales_order_shipment_save_before and sales_order_shipment_save_after events.
  • Observer/AlwaysShipOrder.php: Contains the logic for adjusting stock quantities before shipment creation.
  • Observer/UpdateStockAfterShipment.php: Contains the logic for updating stock quantities after the shipment is saved.

Observer Logic

AlwaysShipOrder

The AlwaysShipOrder observer performs the following actions:

  1. Retrieves all items in the shipment.
  2. For each item, checks the available stock quantity.
  3. If the stock quantity is less than the requested shipment quantity, it adjusts the stock quantity to meet the shipment requirement.
  4. Saves the updated stock quantity using the SourceItemsSaveInterface.

UpdateStockAfterShipment

The UpdateStockAfterShipment observer performs the following actions:

  1. Retrieves all items in the shipment.
  2. Updates the stock quantities after the shipment is saved to reflect accurate inventory levels.
  3. Ensures that the inventory system is up-to-date with the changes caused by the shipment.

Contributing

If you wish to contribute to this module, please fork the repository and submit a pull request with your changes. All contributions are welcome.

Support

If you encounter any issues or have any questions regarding the module, please open an issue on the repository or contact us at [hello@scriptbaker.com].

License

This module is open-source and licensed under the MIT License.

Thank you for using Scriptbaker_ShipOutOfStockItems. We hope it helps improve your Magento 2 experience.

scriptbaker/magento2-ship-out-of-stock-items 适用场景与选型建议

scriptbaker/magento2-ship-out-of-stock-items 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 05 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 scriptbaker/magento2-ship-out-of-stock-items 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 scriptbaker/magento2-ship-out-of-stock-items 我们能提供哪些服务?
定制开发 / 二次开发

基于 scriptbaker/magento2-ship-out-of-stock-items 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-05-17