Country,Region/State,"Zip/Postal Code","Order Subtotal (and above)","Shipping Price"
DEU,_,_,0.0000,3.7500
DEU,_,_,67.2000,0.0000
AUT,_,_,0.0000,9.7500
ITA,_,_,0.0000,9.7500
CHE,_,_,0.0000,9.7500
In the Checkout step "Shipping" when the country is changed the shipping price in section "Shipping Methods" is also changed at the end
The Shipping price at the section "Shipping Methods" is not changed when changing country. It only is changed at the next and final checkout step.
Hello @andidhouse
We tried to reproduce the issue using next test case:
Country,Region/State,"Zip/Postal Code","Order Subtotal (and above)","Shipping Price"
DEU,,,0.0000,1.1100
DEU,,,20.0000,0.0000
AUT,,,0.0000,2.2200
ITA,,,0.0000,3.3300
CHE,,,0.0000,4.4400
1 Go to Storefront as guest
2 Add simple product to cart
3 Go to Checkout
Actual=Expected result:
- Default Country = United States,
- Table Rates is not available
- All other fields on Shipping step are empty
4 Change value for Country = Germany(DEU) and click outside the Country dropdown
Actual=Expected result:
- Table Rate is appeared, price = 1.11
5 Change value for Country = Austria (AUT) and click outside the Country dropdown
Actual=Expected result:
- Table Rate is appeared, price = 2.22
6 Change value for Country = Italy (ITA) and click outside the Country dropdown
Actual=Expected result:
- Table Rate is appeared, price = 3.33
7 Change value for Country = Switzerland (CHE) and click outside the Country dropdown
Actual=Expected result:
- Table Rate is appeared, price = 4.44
8 Now back to the Shopping Cart page
9 Change Qty for simple product = 2 (price should be 20)
10 Click Update Shopping Cart button
11 Proceed to checkout
12 Change value for Country = Germany(DEU) and click outside the Country dropdown
Actual=Expected result:
- Table Rate is appeared, price = 0.00
So we verified all condition from attached CSV file for Table Rate. And each of them leads to Expected Result.
Probably we missed some required precondition or magento settings.
Could You pls provide more detailed information?
hi @sdzhepa
i think there are two problems:
Pls also make shure for testing that only "table rates" shipping is activated - no other calculation method.
@andidhouse
Thank You for clarification. The bug is presented in case if we have only one shipping solution - Table Rate.
We have created an internal ticket MAGETWO-55380
to fix the problem.
"and click outside the Country dropdown"
You are right! This action is not required in the case's steps. It seems was added by mistake. We can just wait ~1-2 sec and request will be send. Sorry for confusing.
The problem with it appears if Table Rate is only one shipping solution(this information was added to MAGETWO-55380
).
Hi @andidhouse, currently we have a configuration file for every single shipping method that contains a list of fields that required to fetch rates. We do not analyse a content of the uploaded CSV file to dynamically change that list. By default it is ZIP, Country and State but you can change that for the particular method. I filed an improvement to have a functionality that allows to upload a matrix that will allow to have different setup per address attribute, including Country.
hi @asemenenko,
many thanks for the info.
"but you can change that for the particular method."
Can you tell me where i can change this so that the shipping costs are updated on a change of the country dropdown.
I also think it would be a great improvement to have the update more flexible meaning shipping costs for some countries vary. some are really based just on the country some maybe on zip codes. I think the best way here is to analyze the imported csv by the system and then adjust the updates.
Many thanks!
Hi @andidhouse, @asemenenko,
I have the same issue in Magento CE 2.1.2. I am looking for the config file, but is there anybody who can tell me where to find them?
And is there any update about a fix and when we can expect it? Or if it's released already, where I can find it?
Thanks!
Really wondering why bugs are reported here and internal tickets are created... again and again nothing happens here. 4 month later now and the bug is still there and nobody seems to care?
I really really need this as well guys. Come on, it shouldn't be hard, please!
I need the configuration file and turn it off for regions. Because regions are not displayed (not necessary for NL for example, but are validated for the price estimation).
@TommyKolkman I used a little cheat/workaround. I removed the "price" column in the checkout at the shippingmethods and added the price in the "Title" or "Description" of the ship. method. I did this for both the Dutch and for Belgium storeviews. This is absolute not a solution, but the customer knows what the costs are and is not having any surprises in the checkout in the next step. It's not a solution, but maybe a "hack" you might consider?
The price is calculated correctly in the last step, so for me it works for the time being.
I do wonder why this issue isn't that much of a priority?
Guys, I think I've found it. I've modified these files in my theme:
app/design/frontend/<vendor>/<theme>/Magento_OfflineShipping/web/js/model/shipping-rates-validation-rules/tablerate.js
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*global define*/
define(
[],
function () {
"use strict";
return {
getRules: function() {
return {
'postcode': {
'required': true
},
'country_id': {
'required': true
},
'region_id': {
'required': false
},
'region_id_input': {
'required': false
}
};
}
};
}
);
And:
app/design/frontend/<vendor>/<theme>/Magento_OfflineShipping/web/js/model/shipping-rates-validator/tablerate.js
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*global define*/
define(
[
'jquery',
'mageUtils',
'../shipping-rates-validation-rules/tablerate',
'mage/translate'
],
function ($, utils, validationRules, $t) {
'use strict';
return {
validationErrors: [],
validate: function (address) {
var self = this;
this.validationErrors = [];
$.each(validationRules.getRules(), function (field, rule) {
if (rule.required && utils.isEmpty(address[field])) {
var message = $t('Field ') + field + $t(' is required.');
var regionFields = [];
if (
$.inArray(field, regionFields) === -1
|| utils.isEmpty(address['region']) && utils.isEmpty(address['region_id'])
) {
self.validationErrors.push(message);
}
}
});
return !Boolean(this.validationErrors.length);
}
};
}
);
And that works for me. Cleared all the caches (browser caches as well, don't forget!) and it does seem to work. Be aware, it's not thoroughly tested.
I guess these are the "config" files... Jeez.
@Tristan-N thanks for that fix as well!
@TommyKolkman many thanks - we will try this :-).
Does it also solve the problem that the right shipping price is shown at the cart page when another country is choosen via the dropdown?
Hi @andidhouse, I'm not using that one, so I wouldn't know. But I guess it should, using the same code in the end. Still, postcode is necessary then I suppose, but by modifying my files above you should be able to make it work.
Hi @TommyKolkman ,
we just tried to implement the fix on our site and changed the file:
app/design/frontend/
to
`/**
Unfortunately this works - only sometimes. If you now change the country dropdown sometimes the shipping price and tax is changed - and sometimes the section is not reloaded.
Did we forget something to make this work on any dropdown change of the country field?
How can we force the that the date is really changed?
Many thanks!
@andidhouse Did you remove pub/static/*, var/di, var/view_preprocessed and did you run setup:static-content:deploy after that? Are you running in production mode or Development mode?
@andidhouse Did you only change shipping-rates-validation-rules/tablerate.js? There's two files! (Don't forget shipping-rates-validator/tablerate.js).
And yes, do everything the wise @Tristan-N says, also don't forget to clear your browser cache, it's a JS change in the end!
Hi @Tristan-N
yes - romoved all files and also ran deploy, and all other command to reset the system.
We are running in development mode right now. Should this be a problem?
@TommyKolkman
yes - we changed both files the second you mentioned we took like you posted above - or do we need to change this as well when we just want to load the data again when choosing the country dropdown.
and yes we also cleared browser cache :-)
we just tried with the default theme to make shure it is not our problem but then we realized that there is a problem with the countries list in the dropdown.
The default country reloads the values every time
The pipe (second entry) reloads the value every time
The first entry in the list (which is Italy at our system) reloads the values every time
We also checked this on the default theme and there it also not really working...
BUT the next countries in the list DO NOT reload the values every time!
It'd be helpful getting some additional info from the magento team about when is this supposed to be fixed.
@TommyKolkman thx your solution is working for me.
@amansilla do you work with table rates and more then two countries? our problem mentioned above still exists.
@andidhouse I'm not sure why it fails for you. I haven't worked with your situation, but I do know that you need a region_id for Germany. So you might try to have that one required but not the others?
Other than that, I just want the Magento team to fix it for you, because this is quite a heavy bug. I've just done some eh... buggy patching.
@andidhouse yes, I'm working with more than two countries and table rates configured just to calculate depending on country.
@TommyKolkman your suggestion works in case of shipping address was already filled and user reload page with previous data and order placed with wrong data
@andidhouse did you get any solution
@andidhouse @TommyKolkman
I am using table rates for singapore and rest of world -
Singapore shipping Costs for Rods
1 Rod 25
2 Rods 25
3 Rods 35
4 Rods 35
5 Rods 45
6 Rods 45
Global Shipping Costs for Rods.
1 Rods 100
2 Rods 100
3 Rods 130
4 Rods 200
5 Rods 230
6 Rods 260
1 Go to Storefront as guest
2 Add simple product to cart
3 Go to Checkout
4) Singapore is default country
5) But it show global shipping costs
any suggestion?
I figure it out, i forgot to set Tax configuration, and set default country to singapore
Actually this should work by default if you have more then one shipping method, if you are using table rates and you want to work by country only using the table rates you can do a trick.
Add the free shipping method in admin, and set the "Minimum Order Amount" with a very large number, ex 9999999.
And now it works!
Special thx to Rene Elshout!
I confirm this is still an issue in version 2.1.7. Summary: one custom (3rd party) shipping method, shipping rates do not update when country changes. After adding "Free Shipping", rates now update when country changes.
Since we have no visibility of the internal Magento bugs, I hope that MAGETWO-55380 is still open and being worked on.
Thanks to the users above who suggested this work around.
@andidhouse, thank you for your report.
The issue is already fixed in develop branch, 2.2.0, 2.1.9
I'm facing the same issue. Let me know the fix for this issue. My current magento version is 2.1.7. It's pretty urgent. Kindly do the needful.
@magento-engcom-team can you refer to the commit that fixed this issue?
@magento-engcom-team what commits fix this issue?
@magento-engcom-team I can confirm that this issue is still present for me using Magento 2.2.4 with table rates listed for all countries other than UK (I think there are about 15 available countries which we do not ship to), and free shipping available for UK only.
@TommyKolkman please could you annotate your answer? I'm still getting to grips with magento and I'm developing a custom theme which already manipulates Javascript, so may need to make additional changes... and also would prefer to know what I'm actually doing :P. TIA!
The logic is surely just that the function to reload shipping must be placed within
$(dropdown).on("click", country-list-member, function() {
// update shipping rates
}
Although this method of injecting javascript, as well as magento development on the whole, are new to me... so I'm having a little trouble interpreting how it all comes together.
Most helpful comment
Really wondering why bugs are reported here and internal tickets are created... again and again nothing happens here. 4 month later now and the bug is still there and nobody seems to care?