I am working on my first Umbraco Commerce site. I’ve set up a product adapter that pulls products from a PIM.
I initially had issues where the price I return in the GetProductSnapshotAsync() method was null by the time I added the product to an order - creating an IOrderLineCalculator made sure I could get around that problem.
Now I have set up a few shipment methods that all rely on weight and other parameters, however once I go through a checkout flow and want to get the prices for each shipment method it returns an unsuccessfull attempt on the TryCalculateRatesAsync():
var order = await _umbracoCommerceApi.GetCurrentOrderAsync(store.Id);
var shippingMethods = await _umbracoCommerceApi.GetShippingMethodsAllowedInAsync(order.ShippingInfo.CountryId!.Value).ToListAsync();
var shippingMethodsRates = await Task.WhenAll(shippingMethods.Select(x => x.TryCalculateRatesAsync()));
This code snippet was taken directly from the documentation.
It makes sense it cannot calculate prices depending on weight when no weight is set, however, in the product snapshot I don’t see any specific properties for weight or measurements.
I’ve tried adding “weight” to the Measurements list, and also tried adding it to the Properties dictionary but it doesn’t help.
Does anyone have any insight into how this should be done?