magento / magento/inventory

eGift Card compensation never happens

Open
#3,418 1 comment 0 reactions 1 assignee View on GitHub

@engcom-November is already working on this.

Since Jun 26, 2025.

Progress: ready for grooming
Dominant language
PHP
Stars
357
Forks
262
PR merge metrics
No merged PRs in 30d

Description

Preconditions (*)
  1. V 2.4.6-p8
Steps to reproduce (*)
  1. Create an eGift card and assign at least one source to it, make the qty 0 and make it available for backorder.
  2. Create the order for the eGift card
  3. Make sure the invoice is created (if invoice is not automatically created, create from admin)
Expected result (*)
  1. Order is created as well as invoice.
  2. There should be 2 entries in inventory_reservation table for that order and SKU:
    • for the reservation
    • for the compensation
Actual result (*)
  1. Order is created, and invoice is created.
  2. There is only one entry in inventory_reservation table and that is for reservation
  3. No compensation entry is created.

The actual issue

When system is trying to create the compensation it tries to gather the qty info for that product.
https://github.com/magento/inventory/blob/132d98c9a7afe75d7d7e74ad2b340cfc0baecc80/InventorySourceSelectionApi/Model/Algorithms/Result/GetDefaultSortedSourcesResult.php#L116

In this line you can see it is going to set $qtyToDeduct to 0 as we have set 0 in the product level.

https://github.com/magento/inventory/blob/132d98c9a7afe75d7d7e74ad2b340cfc0baecc80/InventoryShipping/Model/SourceDeductionRequestsFromSourceSelectionFactory.php#L101

And because of this system cannot mark any source to deduct which is why it will never compensate them.

Because of this, there are so many entries in the reservation table that will stay there forever.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.