More in this section
Forums / Ecommerce / Preferred shipping method for a product

Preferred shipping method for a product

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Jelle Spaan | RedMatters
    Jelle Spaan | RedMatters avatar
    26 posts
    07 Sep 2010
    26 Jun 2012
    Link to this post
    Hi all,

    I was wondering if it is possible to set a preferred (specific?!) shipping method per product? One of our customers offers a variety of products, which include some books (shippingcosts based on weight) and some boardgames (shippingcosts are fixed because of productsize).

    At the moment a visitor who orders a copy of a boardgame will be presented with two different shippingmethods when in checkout; the weight-based method and the fixed-price method. Obviously a visitor will select the weight-based method, since it's cheaper than the fixed price. What should I do in this case?

    Thanks already for reading this thread. I'm looking forward to any possible solution!

  2. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    13 Aug 2007
    26 Jun 2012
    Link to this post
    Hey Menno,

    Although there's a setting to change sort order for Shipping BackendViews (admin>> advanced>> shipping>> controls>> shippingbackenddefinition>> views>> Shippingbackendmaster> sort expression), unfortunately there isn't for FrontEnd. But even if there was, it wouldn't solve your problem...

    By playing around with the shipping service you'll notice that you can't sort on 'ShippingPriceToDisplay' field and then still a percentage based value will only output the percentage, not the actual end cost.

    (  The Firefox RESTClient plugin is awesome for this
    1. login to your sitefinity backend (so your browser will be authenticated)
    2. Click on the RESTClient icon and type in the url:  http://yoursitename/Sitefinity/Services/Ecommerce/Shipping/ShippingMethod.svc//?&sortExpression=ShippingPrice%20ASC  

    So the only option seemed left is to custom drop the payment methods in, 'manually' sorted and or 'filtered' by you. You could use a snippet like this to retrieve them: 
    private void GetShippingOptions()
      var availableShippingMethods = new List<IShippingResponse>();
      foreach (var shippingCarrier in Config.Get<ShippingConfig>().ShippingCarrierProviders.Values.Where(x => x.IsActive))
        var carrierProvider = this.ShippingManager.GetShippingCarrierProvider(shippingCarrier.Name);
        ShippingResponseContext shippingContext = carrierProvider.GetServiceRates(this.GenerateShippingRequest());
        if (shippingContext.ShippingResponses != null)
      availableShippingMethods = availableShippingMethods.OrderBy(x => x.SortOrder).ToList();
      shippingMethodsList.DataSource = availableShippingMethods;

    And then use 'ShippingPrice' to further filter out and sort them.
    For instance "quantity|2|5|5" vs "fixedPercentage|||10" so they wouldn't even show up if the products in the order are from a specific type.

2 posts, 0 answered