Calculate shipping rate based on postal code (Shipping 2.x)
Hi!
I would like to add a rule that will change the shipping fee for a specific amount based on the postal code field the user gave.
For example:
If you want your stuff to be shipped to Smalltown, you will to pay $10 for shipping and if you want it to Awesometown, you have to pay $5. And of course I would like Commerce to decide what amount to charge based on the postal code.
I know I need to set up a rule to check the postal code field's content and if it's equal to something, then calculate the shipping fee, but I can't bring the postal code field into scope.
Anyone know how to do that?
I've posted this problem before, but did not get any answers, I hope it's appropriate to post again.
Update:
Doing the comparison solved, I just needed to use Order address component comparison instead of Data comparison...
But how can I set the shipping fee to a specific amount? I tried Set a data value action but the way I could do it, all the shipping services got the amount.
Comments
For the postal code you use
For the postal code you use the condition "Order Address Component Comparison". If you look at the various videos on Taxes, you'll see this used a lot.
Thanks, I got that figured
Thanks, I got that figured out as I wrote in the update, but after solving this I got a new problem.
Now I just need to create an action that will set one of the shipping services' fee to a specific amount.
I tried Set the unit price to a specific amount but this way the action will set all two shipping services' fee to that amount and I just need that one service's fee to change.
Use a component
I suspect you'll have to use a component. You'll create a loop that calls an action which is a component. The component will check to see that the line item is of the correct type and take an action if that's the case.
Problem solved. I posted a
Problem solved. I posted a tutorial to User guide here: http://www.drupalcommerce.org/node/2511