I have a basic commerce shop setup and I need to recalculate the price based on the delivery region within the country.

The first approach I tried was to add a list field for the customer profile type and defined various regions. The idea was to recalculate the price based on the selected region and the current total price with the price resolver, the problem was I couldn't access the custom added field value, after the information had been entered in the order information form.

I should note that all purchases would be make by guest accounts.

Is it possible to access this information that way?

I'm currently looking at the shipping module but it seems it doesn't really support this approach because it's more oriented towards characteristics such as weight and dimensions.

Any advice on how to tackle this issue?

I'm using Drupal 8.

  • Do you want to change product price (not the shipping price) based on region? If yes, I'd handle this as a product variation, and not in checkout. – Hudri May 6 at 9:26
  • Is this on Drupal 7 or Drupal 8? – Ryan Szrama May 6 at 20:11
  • It's on drupal8 – Insendioo May 7 at 6:46
  • how would that work with product variations? Wouldn't the buyer have to select the region for each product? I'm not too experienced with this so i apologize in advance for not getting it right away. – Insendioo May 7 at 6:57

Price resolver might be the thing you need. Here's the example: https://www.drupal.org/project/commerce/issues/2931445#comment-12391622

| improve this answer | |

Here is a very similar discussion on the subject. Original author ended up creating and contributing a custom module commerce_country_store which is probably worth a try. The discussion above has a lot of options discussed and might be worth a thorough read but not easy to summarize in this post.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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