Skip to content

Order-line carrier assignment ​

When Logidav creates an order line, SaleService::addOrderItem() calls calculateSaleProductRealShippingMethod() before saving it. The result is a line-level real shipping method; it is distinct from the order's requested shippingMethod, the sale-level real shipping method, a printed carrier label, and proof of shipment or delivery. See order import and line creation and shipment generation.

Scope

The rules below describe the source at the cited revision, not the active production configuration or an endorsement of the business policy. The first matching branch chooses an initial method; later overrides and the order-level grouping step can change it. Do not use this page alone to reassign a live shipment.

Inputs and eligibility ​

  • The country comes from the order-info shipping address when present, otherwise the sale's shipping country; if both are empty, the code defaults to FR. A four-character postcode is padded with a leading zero and its first two characters form the department.
  • For classic IDF, isEligibleIdf() accepts France departments 75, 91, 92, 93, 94, 95. For floor delivery, isEligibleIdfEtage() additionally accepts 77 and 78.
  • The Chronopost eligibility helper requires monocolis to be true, total package count less than 3, and total weight at most 30 kg. For a sale line, totals are product package count and product weight multiplied by quantity. Some branches deliberately test quantity 1 instead.
  • For MeublePromo, requested order method classic_classic sets the line's delivery mode to classic; etage_etage sets it to etage.

Sources: carrier selection, IDF eligibility, parcel eligibility and Chronopost thresholds.

Initial selection, in order ​

First matching conditionInitial line method
Store ID is strictly integer 15, customer email is exactly amazon@menzzo.fr, and dropship supplier is AsirGroupAMAZON
Delivery mode is etage or etage_with_assemblyTRUSK if floor-delivery IDF eligible; otherwise VIR
Delivery mode is retraitRETRAIT
Classic IDF eligible, supplier is not AsirGroup, and order source is neither Channable nor TemuECO_IDF
Store 3 in France and product toShipWith is vir, or store 23/26 and toShipWith is virVIR_BAS_IMMEUBLE initially; see final override below
Store 23/26, AsirGroup productIf product with quantity 1 is Chronopost eligible, CHRONOPOST; otherwise ECO_PREVOTE in France or EXPRESS_CALBERSON elsewhere
Store 23/26, other supplierIf product with quantity 1 is Chronopost eligible, CHRONOPOST; otherwise VIR_BAS_IMMEUBLE initially
Spain or Portugal, and either quantity-1 product is not Chronopost eligible or the product weight is over 14 kg and the full line is Chronopost eligibleEXPRESS_CALBERSON
Full line is Chronopost eligibleCHRONOPOST
Outside France and the product with quantity 1 is Chronopost eligibleCHRONOPOST, even if the full-line test failed
No earlier condition matchedECO_PREVOTE in France; EXPRESS_CALBERSON elsewhere

These are the exact code values, not a complete mapping of commercial carrier names. In particular, avoid treating every ECO_PREVOTE assignment as proof of a Geodis label. See the ordered branches.

Overrides after initial selection ​

  1. For a classic line that is not already CHRONOPOST and has compositionOffre, the method looks up the first SKU in the semicolon-separated composition. If that product is eligible at quantity 1, it compares the rounded-up single-parcel cost multiplied by the number of entries against the rounded-up non-single-parcel cost of the original product, both using store 3. A strictly cheaper single-parcel cost changes the line to CHRONOPOST. Exceptions are logged and this comparison is skipped.
  2. Any remaining VIR_BAS_IMMEUBLE becomes ECO_PREVOTE for France or EXPRESS_CALBERSON otherwise. This override happens after the earlier VIR branches.
  3. Otherwise, a CHRONOPOST line becomes GLS when product weight multiplied by line quantity is strictly below 19 kg. At exactly 19 kg it stays CHRONOPOST. This particular choice checks weight only; do not substitute the separate isGlsable() dimensions helper.

See composition and final overrides and GLS weight check.

A later order-wide reassignment ​

After a new sale is created, the registered mz.after.sale.created listener calls checkAndSwitchSaleProductRealShippingMethod(). It collects non-canceled, non-shipped, non-printed lines whose line method (or sale-level fallback) is CHRONOPOST or GLS, and whose availability is exactly En_Stock or is marked sent in stock. It sums product package count × line quantity.

At 3 or more packages in France, or 8 or more outside France, it replaces the method on those collected lines: ECO_TDL for departments 08, 09, 39, 41, 43, 51, 58, 61, 70, 82, 89, 90; otherwise ECO_IDF if the checked line is IDF eligible; otherwise ECO_PREVOTE. The code applies the postcode list without an explicit country guard. The IDF check uses the last loop variable, so the evidence supports the implemented condition, not a redesigned group policy.

The product service also calls this grouping method during updateProductDispo() when the calculated availability is En_Stock: it updates the selected processing, unprinted, no-stock sale lines, collects their sales and checks each sale again. This does not prove every availability-change path invokes the method. See grouping implementation, listener registration and availability update.

Recalculation after a change ​

  • The chatbot address-update path invokes order-wide recalculation after updating the address. Its method skips shipped or canceled lines but includes printed lines, saves affected lines and reports carrier changes.
  • Delivery-mode changes, pickup-to-delivery processing, product replacement and certain alert actions also call the per-line calculator. Eligibility, side effects and transaction boundaries depend on their individual callers; the calculator alone does not establish a successful carrier update or label replacement.
  • A new-order creation dispatches the order-created event; the existing-order import branch dispatches update events instead. Do not assume an existing-line update repeats all creation or grouping rules.

See recalculation, chatbot address update, and the workflow rules inventory.

Investigating a surprising carrier ​

Record the sale source, store ID, customer email, country, postcode, requested and real methods, delivery mode, supplier, product weight, package count, quantity, monocolis flag, toShipWith, composition, availability and printed/shipped/canceled state. Trace the first branch, then the final overrides and grouping. Check the most recent recalculation or operator action and the saved line, label and carrier response separately. The reviewed source does not establish which revision is deployed, live labels, rate calculations or whether an external carrier accepted a shipment.

Internal developer documentation for Menzzo systems.