3ART Technologies
2020-06-21T18:01:09Z
I tried to add the shipping charges in my custom server-side module but I am not able to get the amount, can any one tell me how can i get the shipping in my custom module.

it is always returning me empty shipping value

var HccApp = HccAppHelper.InitHccApp();
var cart = HccApp.OrderServices.CurrentShoppingCart();
var shipping = HccApp.OrderServices.FindAvailableShippingRates(cart, HccApp);
return shipping.ToList();
Will Strohl
2020-06-23T17:01:04Z
I'm unclear as to what you're trying to do, so I'd recommend looking at the checkout controller if you're trying to duplicate the checkout process.

https://github.com/hotca...eckoutController.cs#L142 

https://github.com/hotca...eckoutController.cs#L176 
Will Strohl, Upendo Ventures
Hotcakes Cloud  | Get Support  | Code Support 
Official Cloud & Support provider for Hotcakes
3ART Technologies
2020-06-24T15:28:07Z
Thanks for the links but I already found this solution. I am creating my own cart page and checkout custom page, and for this, I need to calculate the shipping with only one country KSA no need to select the country from the dropdown.

I already achieved it by the following code.

public List<ShippingRateDisplay> shipping_Charges()
{
var HccApp = HccAppHelper.InitHccApp();
var orders =HccApp.OrderServices;
var cart = HccApp.OrderServices.CurrentShoppingCart();

cart.ClearShippingPricesAndMethod();

var country = HccApp.GlobalizationServices.Countries.FindByISOCode("SA");
cart.ShippingAddress.CountryBvin = country.Bvin;
cart.ShippingAddress.RegionBvin = "";

orders.Orders.Update(cart, true);
HccApp.CalculateOrderAndSave(cart);

var shipping = HccApp.OrderServices.FindAvailableShippingRates(cart, HccApp);
return shipping.ToList();

}
Loading
  • Sign-up for the Hotcakes Community Newsletter: