No shipments created for placed sales orders in Litium 8

In Litium 7, when using Klarna and Klarna Shipping, a delivery/shipment is automatically created with state INIT when an order is placed.

In Litium 8, when using the Klarna App and Klarna Shipping, no shipments are created when orders are placed.

Is this how it’s supposed to be?

And if so, how are shipments supposed to get created? Or are sales orders in Litium 8 supposed to be shipment-less when using Klarna Shipping?

We are using the Klarna App, and the Direct Shipment App, and everything works fine. But no Shipments are created.

Litium version: 8.6.1 + Accelerator + Klarna App + Klarna Shipping

In Litium 8 the ShippingInfo (SalesOrder.ShippingInfo) on the order is set during the checkout. When the package is ready to be delivered the shipment is created in Litium and when the shipment is ready to be sent, the payment app will be notified for the capture process. Order fulfillment (litium.com)

1 Like

So what should we do in code to tell Litium that

  • the package is ready to be delivered, and that
  • the shipment is ready to be sent

?

On the Order fulfillment (litium.com) you have a link right after the first image for the order fullfilment flow that take you to Business processes (litium.com).

On the business processes page, you have the Order fulfilment process - Main flow (litium.com) and Order fullfilment process - Alternative flow (litium.com) that describes the process and what endpoints that should be executed.

It’s also possible to use the Litium.Sales.ShipmentManager directly in the code to create the shipment, and then using the state engine to move the shipment into the Shipped state.

Thanks. We are not using Litium Connect or ERP Connect, so much of those examples don’t really apply.

I can’t get creating a shipment from code to work.

    var shipment = await _shipmentManager.Create(salesOrder.SystemId,
        new CreateShipmentArgs
        {
            Rows = salesOrder.Rows.Where(salesOrderRow => salesOrderRow.OrderRowType == OrderRowType.Product)
                .Select(salesOrderRow => new ProductToShipRow
                {
                    Quantity = salesOrderRow.Quantity,
                    ArticleNumber = salesOrderRow.ArticleNumber
                }).ToList(),
            ShippingMethod = salesOrder.ShippingInfo.First().ShippingOption.OptionId,
            Address = salesOrder.ShippingInfo.First().ShippingAddress,
        }
        );
    var stateTransitionResult1 = _stateTransitionsService.SetState<Shipment>(
        shipment.SystemId,
        ShipmentState.Processing
        );

The Shipment is created, and has a SystemId (but no Id) and a OrderSystemId. But the SetState fails with Success=false but no exceptions or validation errors, so the Shipment is never moved to Processing. And in the Sales UI, no Shipment shows up on the sales order under “Deliveries”, so I can’t see the shipment anywhere in the UI.

If I use an incorrect ShippingMethod I get an exception when creating the shipment.

The ShippingProvider is DirectShipment.

How exactly do you create a Shipment from code?

The ShipmentManager is not persisting the shipment so when you try to set the state the platform is not finding the shipment.

Try to store the shipment with the Create method on Litium.Sales.ShipmentService before setting the new state.

1 Like

Thank you. Everything works fine now.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.