sorry I don't know the name for this problem, nor if it's even solvable.
I'm trying to calculate the new delivery cost based on previous data.
Say we have 2 products with respective delivery cost per item:
Apple --> 7 $ (7 -> current value)
Melon --> 20 $ (20 -> current value)
Then, I make a purchase of:
10 x Apple
50 x Melon
Total new delivery fee is: 1,130 $.
Just with the data above, is it possible to calculate and know that the new delivery fees are:
Apple --> 8 $ (10 x 8 $ = 80 $)
Melon --> 21 $ (50 x 21 $ = 1,050 $)
If the quantities were equal, then I could assume that 25.93% (7 / (7 + 20)) of the delivery fee belongs to Apples, and 74.07% belongs to Melons.
But since quantities are not equal, I have this problem of 2 percentages. I can't say that 25.93 % (based on previous delivery fee) or 16.67 % (based on quantity) of the total belongs to Apples.
This problem comes from making purchases of big and small items. If I just take the total and divide with all quantity, then the smaller items would have their delivery cost higher than their own cost.
Thanks in advance!
update - edit ------------
So I got this idea, it doesn't solve what I asked, but may be good enough for you as it is for me.
Basically, calculate the total delivery fee using old values:
10 x Apple ( 7 $) = 70 $
50 x Melon (20 $) = 1,000 $
total = 1,070 $
Then compare it with the new delivery fee: 1,130 $
1,070 -> 1,130 = 5.6 % Increase
Now I can use that % to update the products delivery fee:
Apple 7 $ + 5.6 % => 7.39 $
Melon 20 $ + 5.6 % => 21.12 $
This is not a solution for what I originally asked in the post (I asked poorly). But I think this might be what you were looking for if you had the same problem as I did.