Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Can't release shipment


Commerce 11.8.2

At the moment in commerce manager we're unable to click release shipment due to the button being greyed out.

I have looked through this forum and while others have come across this issue all the solutions haven't worked for me.

All variants have inventory assigned, along with a warehouse, I have tried both tracked and untracked inventory (I'd prefer untracked but i'll take track for it to work!!)

Looking through the forum and online I need to Adjust/Update the inventory.

Thus, I have tried the following:

        public Dictionary> RequestInventory(ICart cart)
            var validationIssues = new Dictionary>();        
            cart.AdjustInventoryOrRemoveLineItems((item, issue) => validationIssues.AddValidationIssues(item, issue), _inventoryProcessor);
            return validationIssues;

        public Dictionary RequestShipmentInventory(IShipment shipment, ICart cart)
            var validationIssues = new Dictionary();
            _inventoryProcessor.AdjustInventoryOrRemoveLineItem(shipment, cart.OrderStatus, (item, issue) => validationIssues.Add(item, issue));

            // shipment.AdjustInventoryOrRemoveLineItems((item, issue) => validationIssues.AddValidationIssues(item, issue), _inventoryProcessor);
            return validationIssues;

        public Dictionary> RequestInventory(IPurchaseOrder order)
            var validationIssues = new Dictionary>();
            order.AdjustInventoryOrRemoveLineItems((item, issue) => validationIssues.AddValidationIssues(item, issue), _inventoryProcessor);
            return validationIssues;

This doesn't make any difference at all, the button is still disabled.

I have tried to manually set the status:

cart.GetFirstShipment().OrderShipmentStatus = OrderShipmentStatus.InventoryAssigned;

And this also doesn't effect it.

Similary I have tried:

var order = _orderRepository.Load(orderReference.OrderGroupId);
            order.GetFirstShipment().OrderShipmentStatus = OrderShipmentStatus.InventoryAssigned;

Again no luck.

Any assistance or direction would be great.

Jun 14, 2018 18:43

Was the order fully paid?

Jun 14, 2018 19:07

Hi Quan,

We're using Braintree so we get the transaction back from them. Along the lines of:

            var paymentMethod = _paymentService.GetPaymentMethodByType(typeof(BraintreePaymentMethod));

            var payment = _orderGroupFactory.CreateCardPayment(order);
            order.AddPayment(payment, _orderGroupFactory);

            // Set values after adding to collection because of limitation in implementation
            payment.Amount = transaction.Amount.Value;
            payment.CardType = transaction.CreditCard.CardType.ToString();
            payment.CustomerName = transaction.CreditCard.CardholderName;
            payment.CreditCardNumber = transaction.CreditCard.MaskedNumber;
            payment.PaymentMethodId = paymentMethod.PaymentMethodId;
            payment.PaymentMethodName = "Braintree";
            payment.ExpirationMonth = int.Parse(transaction.CreditCard.ExpirationMonth);
            payment.ExpirationYear = int.Parse(transaction.CreditCard.ExpirationYear);
            payment.Status = transaction.Status.ToString();
            payment.AuthorizationCode = transaction.ProcessorAuthorizationCode;
            payment.BillingAddress = _mapper.Map(billingAddress, order.CreateOrderAddress("Billing"));

            order.OrderStatus = OrderStatus.InProgress;

And the value taken through the payment gateway matches the PO

Jun 15, 2018 9:53

You need to set the Payment.TransactionType.

Capture or Sale are the most appropriate if you're charging. (It depends on if you've set up handling for any of them in your IPaymentGateway)

The payment also needs to be processed.

The UpdateTotalsActivity is responsible for setting OrderForm.CapturedPaymentTotal which is what the "IsPaid" clause that Quan mentioned looks at

Depending on your payment handling flow you could alternatively set the TransactionType to Authorization. UpdateTotalsActivity will then add those values to OrderForm.AuthorizedPaymentTotal instead which is also looked at when checking if the order is considered to be paid. 

Edited, Jun 15, 2018 10:47

I have made the suggested changed:

            payment.Status = PaymentStatus.Processed.ToString();
            payment.TransactionType = Mediachase.Commerce.Orders.TransactionType.Sale.ToString();

And still this doesn't make a difference on being able to release the shipment

Jun 15, 2018 11:37

Do you call IOrderGroup.ProcessPayments() somewhere?


It processes the payments and also calls IOrderForm.UpdatePaymentTotals() which does what UpdateTotalsActivity did for the old API (which I for some reason assumed that you used above :P ).

If you don't have an IPaymentGateway/IPaymentPlugin setup for your Braintree implementation you can try calling UpdatePaymentTotals() directly:

Edited, Jun 15, 2018 12:20

I have:

                SavePaymentDetails(order, transaction, command.BillingAddress);
                orderReference = _orderRepository.Save(order);

Where SavePaymentDetails is the above pasted method where set the status etc.

I have also tried


In case there was something wring with our payment gateway but still no difference.

Jun 15, 2018 12:43

Alright, maybe it's not the payments. :)

Either way here's the things that I know of that sets the button as disabled:

  1. Shipping method is the predefined Store pickup but warehouse selected on the shipment is not a pickup location
  2. Shipment.ShippingMethodId is NOT set
  3. Shipment.ShippingAddressId is NOT set
  4. Order status is AwaitingExchange
  5. ShipmentStatus is NOT set to either AwaitingInventory or InventoryAssigned
  6. PurchaseOrder.Total is NOT covered fully by OrderForm.CapturedPaymentTotal + OrderForm.AuthorizedPaymentTotal (and returned items totals, if any), (In other words it's not considered to be paid as we discussed above)
  7. Any of the lineitems does not have appropriate levels of stock for the quantity to be delivered by that shipment.

For purposes of debugging order data I usually use these SQL queries:

DECLARE @OrderGroupId int = '12345' -- Set this to the ordergroupId of the order you want to check

SELECT * FROM OrderGroup og
JOIN OrderGroup_PurchaseOrder po ON og.OrderGroupId = po.ObjectId
WHERE og.OrderGroupId = @OrderGroupId

FROM [dbo].[OrderForm] oform
JOIN OrderFormEx ofex ON oform.OrderFormId = ofex.ObjectId
WHERE oform.OrderGroupId = @OrderGroupId

FROM [dbo].Shipment sh
JOIN ShipmentEx shex ON sh.ShipmentId = shex.ObjectId
WHERE sh.OrderGroupId = @OrderGroupId

FROM [dbo].LineItem l
JOIN LineItemEx lex ON l.LineItemId = lex.ObjectId
WHERE OrderGroupId = @OrderGroupId
ORDER BY LineItemOrdering ASC

FROM OrderGroupAddress oga
JOIN OrderGroupAddressEx ogae ON oga.OrderGroupAddressId = ogae.ObjectId
WHERE oga.OrderGroupId = @OrderGroupId

FROM [dbo].OrderFormPayment ofp
WHERE ofp.OrderGroupId = @OrderGroupId

So if you can get a hold of the orders OrderGroupId you can see what the different values are, for example check OrderForm.CapturedPaymentTotal, Shipment.ShippingMethodId etc etc

Edited, Jun 15, 2018 14:31

That's a very good summary Jeff. I'm going to make it easier to diagnose why a shipment can't be released. I know it has been a pain in the a** for quite some time, but I haven't had time to really do anything about it. Today I can!

Jun 15, 2018 14:59

Thanks, this is helpful. I have run the query and this is what I found, I'm not sure how relvent.

  • In the Shipment table the Status is set to NULL and there is no WarehouseCode
  • In the LineItems table there is no warehousecode but I believe this is obsolete since v9
  • In the lineItems table the InStockQuanity is 0, having checked the [InventoryService] table I can see that they have plenty of stock in the PurchaseAvaliabityQunaity column
  • In the lineitem table IsInventoryAllocated and InventoryStatus are both 0

Apart from that they all look ok

Jun 15, 2018 15:28

Looks like it came down to not setting the WarehouseCode on the shipment and possibly the order in which we processed the payment/saved to a PO.

In earlier versions of commerce we didn't have to explictly set the warehouse code and it just fell back to "default" has this been a change?

Jun 15, 2018 18:07
  • In the Shipment table the Status is set to NULL and there is no WarehouseCode
    This is an issue, How does the code where you create your shipment look like? (what happens before running cart.AdjustInventoryOrRemoveLineItems()? Make sure WarehouseCode is set
  • In the LineItems table there is no warehousecode but I believe this is obsolete since v9
    That's correct, this shouldn't affect things in this case.
  • In the lineItems table the InStockQuanity is 0, having checked the [InventoryService] table I can see that they have plenty of stock in the PurchaseAvaliabityQunaity columnLineItem.InStockQuantity is one of the fields that step 7 above checks against. This shouldn't be 0 and should be set when inventory is assigned.
  • In the lineitem table IsInventoryAllocated and InventoryStatus are both 0Is InventoryAllocate should be set to 1 once the inventory has been assigned properly.

So yeah, there seems to be an issue assigning inventory.

Given the things that can disable the button that I listed above, the thing that most likely is stopping you from releasing is the Shipment status being NULL.

EDIT: Ah, you already found the issue. Good thing that it got resolved! :)

Edited, Jun 15, 2018 18:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.