weight calculation services do not take item quantity in consideration?

3 years ago
Hello,
I've developed a shipping rate calculation plugin.
Rates are based on items weight.
However, some users are reporting that changing item quantity (same sku) does not increase the shipping fee.
Adding different products (different skus) works fine.

I am using the IShippingService to get the total cart weight or singe PackageItems weight.
Is there any reason why this service is not taking item quantity into account?

Thank you
3 years ago
Have you looked at how the ByWeight plugin does it...

           decimal weight = _shippingService.GetTotalWeight(getShippingOptionRequest);
3 years ago
Hello,
thank you for your reply.

Yes, that method works fine.
However, in some situations, I need to get the weight of each item in the cart.

I'm using

_shippingService.GetShoppingCartItemWeight(packageItem.ShoppingCartItem);


However, I was inspecting its implementation: it takes the quantity into account only if the ShoppingCatrItem object has some AttributesXml, which I don't know where they should be coming from...

Anyways, I'm fixis this by multiplying the returned weight by the item quantity myself... even though I don't understand why the services doesn't do this on first place...