Skip to main content

recalculateShipmentItemCosts

Recalculates the unit cost held on each line of a shipment.

A line's current cost valuation is calculated when the shipment is first reported. Normal shipment updates leave that valuation stable; this mutation deliberately recalculates it when better source data becomes available.

Business Rules​

  • Every active line on the shipment is recosted from current data.
  • A line takes the supplier unit cost from its fulfillment item when one is recorded, then the product's default landed cost, then the product's default unit cost.
  • A line whose product has none of those is left without a cost rather than being recorded as zero.
  • unitCostCalculatedAt is stamped on every line the mutation touches, including lines whose calculation found insufficient data and left the cost null.

Error Scenarios​

  • **NOT_FOUND**: the shipment does not exist, or does not belong to a v2 order in this company.
  • **UNAUTHORIZED**: missing required permissions or invalid company access.

Permissions Required​

  • orders:update_fulfillment_costs permission
recalculateShipmentItemCosts(
input: RecalculateShipmentItemCostsInput!
): OrderShipment!

Arguments​

recalculateShipmentItemCosts.input ● RecalculateShipmentItemCostsInput! non-null input common​

Parameters for RecalculateShipmentItemCosts

Type​

OrderShipment object shipments​

This type represents an order shipment. An order can have multiple shipments, each one associated with a fulfillment and a carrier that shipped the order