Try our conversational search powered by Generative AI!

How to set multiple shipping methods for cart in EpiServer 12.

Vote:
 

Hello Guys,

I have to implement the split shipment functionality (i.e For some line items shipping method should be 'A' and for some line items shipping should be 'B'). 

It is possible like to set shipping method id and shipping method name to line item As like in 7.5?

I have looked shipment spliting 

https://world.episerver.com/documentation/developer-guides/commerce/shipping/Multi-shipment-examples/

But didn't get enough infromation about how shipment methods (from commerce manager) is get set to line item.

Thank you.

Regards,
Dipak Salve

#193367
May 29, 2018 14:44
Vote:
 

https://webhelp.episerver.com/Commerce/1.1.2/Content/User%20Guide/OrderManagement/SplittingShipments.htm

You can use split shipments feature in Commerce Manager to create new shipments, add/remove items to them. Then add shipping method to each of them 

#193386
May 29, 2018 15:27
Vote:
 

Hello Quan,

Thank you for your reply. But I am looking this through source  code on website side, just like given an example in link above. May be I posted my question in wrong area.

Thank you.

#193387
May 29, 2018 16:22
Vote:
 

So you are trying to load the shipping method to assign to the shipment, or?

#193388
May 29, 2018 16:47
Vote:
 

Hi Dipak,

Shipping method id and shipping method name is no longer under line item (they were obsoleted). They're now under shipment (as well as warehouse code).

In your case, I think it's possible to create multi shipments with different shipping methods, then "pick" line item to corresponding shipment.

/Viet Anh

#193393
May 29, 2018 19:40
Vote:
 

Yes. I mean I am getting shipping method from ShippingManager

ShippingMethodDto methods = ShippingManager.GetShippingMethods(SiteContext.Current.LanguageName);
List<ShippingMethodDto.ShippingMethodRow> shippingMethods = new List<ShippingMethodDto.ShippingMethodRow>();

Now I would have to set IShipment for cart with ShippingMethodId, ShippingName  etc.

#193471
May 30, 2018 9:49
Vote:
 

This should be enough (From Quicksilver)

        public void UpdateShippingMethod(ICart cart, int shipmentId, Guid shippingMethodId)
        {
            var shipment = cart.GetFirstForm().Shipments.First(x => x.ShipmentId == shipmentId);
            shipment.ShippingMethodId = shippingMethodId;
        }

You probably want to validate the cart after because the total/promotions might have been changed 

#193472
May 30, 2018 9:52
Vote:
 
<p>Thank you. Quan this is something I was looking.</p>
#193473
May 30, 2018 11:22
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.