2
Answers
Vote up!
0
Vote down!

How to set up a shipping service with conditions based on a custom field?

Hi,

I have custom fields in my customer profiles (so I don't use the dynamic addressfield) like name, streetname, number, postalcode and country. Now I would like to create 3 different shipping services with conditions based on different countries.

For example:

Shipping 1 = Netherlands
Shipping 2 = Germany
Shipping 3 = Belgium

In my customer profiles I have a custom field called 'country' which have the values Netherlands, Germany and Belgium in a select list.

When setting a condition for the selected shipping service I am unable to select the correct data selector (order address component comparison doesn't work, cause that only works with the dynamic addressfield). I tried using 'entity has field' but that doesn't seem to work either (or I used the wrong settings?).

Any suggestions?

Asked by: J03Y
on September 18, 2013

2 Answers

Vote up!
0
Vote down!

I found a solution. It seems that the 'entity has fields' option does work. Only It had to be in two steps for 'entity has field' + adding a data comparison.

First step was to add 'entity has fields' with the parameter: Entity: [commerce-order], Field: commerce_customer_shipping.

The second step was to add 'entity has fields' with the parameter: Entity: [commerce-order:commerce_customer_shipping], Field: custom_field.

The third step is to use data comparison. Then it does work!

Answer by: J03Y
Posted: Sep 25, 2013
Vote up!
0
Vote down!

Hi
why cant you do it with customer shipping address.

In store -> configuration -> shipping

add a shipping rule.

For Example .

Germany shipping and add price for it . Now you have to click
configure component and

Cick on Add Condition and select 'Order address component comparison'.Then in address box select shipping address and in address component box select country.Now select operator equals and value need to be the 2 character country code and save changes.It will work

Answer by: ajaichandran
Posted: Sep 24, 2013

Comments

Thanks for your reply ajaichandran. Unfortunately that option doesn't work as I indicated.

"order address component comparison doesn't work, cause that only works with the dynamic addressfield"

- J03Y on September 25, 2013

Then Why cant you write PHP code in condition for checking this?

- ajaichandran on September 25, 2013