UPS weight calc not working with ProductAttribute WeightAdjustment

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
My co-worker is using nopCommerce v3.70 with no-source, she has been struggling to get the "Weight Ajustment" in "Product attributes" to work correctly.

Purpose:  work-around the nopCommerce limitation of calculating individual "Ship to alternate recipient" charges on a per item basis.
Solution:  when the user enters the "alternate ship-to state", she has setup a "Price adjustment" for that state (based on downloaded UPS rates) that covers shipping costs, and negates the product weight by using a "negative Weight adjustment".
Example:  an item weighs 4 pounds, choosing "ship to California" adds $15.06 to the price using "Price adjustment", and "-4" pounds "Weight adjustment".  (Dimensional weight has been factored correctly, and the correct negative weight adjustment used when pertinent).

Problem:  the item's weight of 4 pounds does not get negated, so when the shopper gets to the check-out "Shipping Method" page, ANOTHER $15.06 gets added to the order.

She has used the "Tracing" feature in the UPS Shipping plug-in to generate the XML conversation, I helped her decipher that indeed an additional package of 4 pounds gets added to the XML request.

How do we get ProductAttribute WeightAdjustment to work correctly?
Is there a smarter method to exclude an item from shipping calculation?

We are so close to going live, we spent (wasted) several days trying to figure this out, we just need this one item solved.

Thanks in advance!
   ---Jay R O
7 years ago
She upgraded to V3.80 no-source, WeightAdjustment is still broken.
   ---Jay R O
7 years ago
I managed to fix this.  Unfortunately, this site is no longer a "no source" because of this.

Having picked through the code, this seems like a bug.  If an item has no weight, how can shipping be calculated?  Maybe this was done on purpose?  Maybe a setting such as "ShippingSettings.SkipZeroWeightCartItems" would be smarter yet?

Here is my hack solution (20+ years of VB does NOT make me a C#/MVC programmer!):

File: Plugins\Nop.Plugin.Shipping.UPS\UPSComputationMethod.cs
Sub:  SetIndividualPackageLineItemsOneItemPerPackage
Line: 30 (V3.80), just after "var qty = packageItem.GetQuantity();"

Add 4 lines:

//get weight for ShoppingCartItem
decimal weightTmp = _shippingService.GetShoppingCartItemWeight(sci);

if (weightTmp > 0)        // don't calculate shipping if ItemWeight is 0
{


Then close the "if" by add a closing } (curly-bracket) just AFTER the for-loop containing "AppendPackageRequest".

   ---Jay R O
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.