code: protected function resolveSoldDeltaQuantity(SaleItemInterface $item)
      {
          $old = $new = $item->getQuantity();
  
          // Own item quantity changes
          if ($this->persistenceHelper->isChanged($item, 'quantity')) {
              list($old, $new) = $this->persistenceHelper->getChangeSet($item, 'quantity');
          }
  
          // Parent items quantity changes
          $parent = $item;
          while (null !== $parent = $parent->getParent()) {
              if ($this->persistenceHelper->isChanged($parent, 'quantity')) {
                  list($parentOld, $parentNew) = $this->persistenceHelper->getChangeSet($parent, 'quantity');
              } else {
                  $parentOld = $parentNew = $parent->getQuantity();
              }
              $old *= $parentOld;
              $new *= $parentNew;
          }
  
          // Sale released change
          $sale = $item->getSale();
          $shippedOld = $shippedNew = 0;
          $f = $t = false;
          if ($this->persistenceHelper->isChanged($sale, 'released')) {
              list($f, $t) = $this->persistenceHelper->getChangeSet($sale, 'released');
          } elseif ($item->getSale()->isReleased()) {
              $f = $t = true;
          }
          if ($f || $t) {
              /** @var StockAssignmentsInterface $item */
              foreach ($item->getStockAssignments() as $assignment) {
                  if ($this->persistenceHelper->isChanged($assignment, 'shippedQuantity')) {
                      list($o, $n) = $this->persistenceHelper->getChangeSet($assignment, 'shippedQuantity');
                  } else {
                      $o = $n = $assignment->getShippedQuantity();
                  }
                  if ($f) {
                      $shippedOld += $o;
                  }
                  if ($t) {
                      $shippedNew += $n;
                  }
              }
  
              if ($f) {
                  $old = min($old, $shippedOld);
              }
              if ($t) {
                  $new = min($new, $shippedNew);
              }
          }
  
          return $new - $old;
      }
docs: Resolves the assignments update's delta quantity.
  
  @param SaleItemInterface $item
  
  @return float