Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Maria 2 posts 72 karma points
    Sep 04, 2017 @ 07:54
    Maria
    0

    Merchello Shipment Rates

    Hello,

    I am using Merchello version 2.4.0 and I have an error getting the shipment rates. I am using the code below and the method shipment.ShipmentRateQuoteByShipMethod(item.Key, false) always throws a null exception.

      var key = Merchello.Core.Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey;
            var rateTableProvider = MerchelloContext.Current.Gateways.Shipping.GetProviderByKey(key);
            var shippingMethods = rateTableProvider.ShipMethods;
            var shipment = this.Basket.PackageBasket(shippingAddress)?.FirstOrDefault();
            if (shipment != null)
            {
                var item = shippingMethods.Where(s => s.Name == "Standard Shipping").FirstOrDefault();
                var shipmentRate = shipment.ShipmentRateQuoteByShipMethod(item.Key, false);
    

    } enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft