1
  • I have a flat rate of $2.50 for every order.
  • I have extra +$1 for every extra item added to cart.

So, if I order 1 item, total shipping is $2.50, but if I order 2 items total shipping is $3.50.

My problem is that in 2nd case, I get total shipping of $4.50 for 2 items instead of $3.50. It calculates the +$1 for both items.

I added the rule condition Total product quantity comparison to apply +$1 if quantity is > 1. So if I add only item, it doesn't calculate the extra shipping, but as soon as I add more items, it calculates the extra shipping for initial item.

Here's my calculation rule: enter image description here

I followed this guide: https://vimeo.com/32813567

2
  • I think your "Add an amount to the unit price" should be outside of the loop function.
    – jmu
    Commented Aug 29, 2017 at 14:17
  • @jmu then you will get 'Error: Data selector result for parameter amount is invalid' error. Commented Aug 29, 2017 at 17:46

1 Answer 1

1

From the screenprint of your calculation rule it's hard to tell what exactly the logic is that you implemented (an exported rule, created with the Rules UI, provides ALL the details).

Anyway, it seems that your Rules Loop is adding $1 for EACH line item, so also for the very first line item. While your requirement (in your question) states "+$1 for every extra item" ... If "extra" is to be translated to "but do not add $1 for the very first item", then clearly in your Rules Loop you should not have added $1 for the very first item.

The easiest way to correct this, is to subtract $1 after your Rules Loop is finished (consider it like a discount for the very first item). If you rather want to go for a slightly more complicated solution, then you could use the Conditional Rules module to add an extra test (Rules Condition!) within your Rules Loop to NOT perform that +$1 for the very first line item (I presume you know what such test should look like). My 2 cents: go for the easiest way via the extra correction after the Rules Loop is finished.

2
  • You're right, I already solved it with adding subtraction outside loop. Commented Aug 29, 2017 at 21:24
  • @user3108268 merci for the feedback (+ accept/upvote) ... curious to ever hear your feedback about my answer to your other question (which might take a little longer to digest maybe ...) Commented Aug 29, 2017 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.