Supply Lens

Shipments, stock and credit memos

Lesson 8 of 30 7 min read

Update Magento shipments, push stock to the right inventory source without hitting rate limits, and import credit memos.

Orders are only half a Magento project. Customers expect a despatch email, the shop needs stock it can trust, and refunds raised in Magento need to reach the books. Magento has a Configuration for each, and each has one or two decisions worth getting right.

By the end of this lesson you'll be able to configure Magento Shipment, Inventory and Credit Configurations and avoid the rate-limit and duplicate-email traps.

Shipments: what the customer sees

notifyWhen true, Magento emails the customer a shipment notification. When false or unset, no email.
defaultCarrierCodeThe carrier code set on the Magento shipment when the fulfilment data doesn't provide one, so every shipment has a carrier.
appendCommentWhen true, a comment is appended to the Magento shipment.
commentThe static comment text used when appendComment is true.

Decide who sends the despatch email

If the 3PL or another app already emails customers, leave notify off or customers will get two emails. If nobody else does, turn it on.

Stock: which source, and how fast

defaultSourceCodeThe Magento inventory source that receives stock updates.
useBulkEndpointUse Magento's bulk inventory endpoint instead of individual calls. Generally faster for many products.
useSingleProductUpdateUpdate each product individually. Slower, but useful when a Magento setup can't handle bulk operations.
rateLimitPermitLimitThe maximum number of API requests in each rate-limit window.
rateLimitWindowThe length of the window, for example 00:01:00 for one minute. Requests beyond the limit are throttled.
customAttributeTagMapsRules that read Magento product custom attributes and turn them into tags, each with an attributeCode, a valueIsLabel switch and a tagMap with a default.

Start with the bulk endpoint. If the host or an extension struggles, switch to single-product updates and set a rate limit the host can cope with.

Good to know

Magento's multi-source inventory lets a shop hold stock against several sources. Supply Lens sends to the one in defaultSourceCode, so make sure it's the source the storefront sells from.

Credit memos: refunds into the back office

setupDate / lastImportDateGo-live cut-off and watermark, as for orders.
importDelayWait before importing a credit memo, so other systems can finish changing it.
useBaseValuesUse base currency amounts for the credit memo, matching the choice you made for orders.

Keep useBaseValues the same on Order and Credit, or a refund may not match the order it reverses.

Rendering diagram...

Fern & Finch: a slow host

Fern & Finch's Magento host throttles heavy traffic, and stock updates for 2,000 SKUs were timing out.

  • The implementer keeps useBulkEndpoint on but sets rateLimitPermitLimit to a value the host agreed and rateLimitWindow to 00:01:00.
  • defaultSourceCode is the default source the storefront sells from.
  • On shipments, the 3PL already emails tracking, so notify stays off. defaultCarrierCode covers the occasional shipment without a carrier.
  • Credit memos get a five-minute importDelay and useBaseValues matching the orders.

Recap

  • notify controls Magento's shipment email; avoid double emails.
  • defaultCarrierCode guarantees a carrier on every shipment.
  • Stock goes to defaultSourceCode; prefer the bulk endpoint, and rate-limit when the host needs it.
  • Credit memos have their own delay and base-values setting; match the order settings.
Complete and take the quiz

Your progress is saved in this browser. Create a free account to keep it everywhere, take quizzes and earn certificates.