Forum
Change shipping price based on location set on cart page
I'm trying to set up a shop with one shipping method for UK but with different shipping price for locations that the price needs to be different eg. Jersey, Guernsey etc
I need the customer to be able to select their location from a drop down list on the cart page, then the price for shipping changes along with the total for the order.
Similar to what James is asking here: https://forum.grabaperch.com/forum/10-21-2016-shop-shipping-zones
If I use the tag below and change the location which has a different price, the cart doesn't update the shipping price.
perch_shop_location_form();
Any ideas how I would do this please?
So are you saying that when you change location, the cart needs to recalculate the shipping?
Yes please.
I have the zones setup and if I select one from the dropdown a la 'location form' click the OK button it does a page refresh but doesn't update the Shipping cost.
Drew, any ideas on this please?
Yes, it's something we're looking into.
To be clear - the location form sets the tax location. It's the shipping address that sets the shipping costs. Are you expecting those two to be the same? They're actually two different things.
I think maybe my confusion has come from me reading your answer to the other thread I mentioned, where you said about perch_shop_location_form(). Not expecting them to be the same just trying to get it working as mentioned here:
Added this to the cart page:
and this is the custom template:
I just need a list of available shipping zones eg. UK, Guernsey, Jersey etc then once one is selected the shipping price changes accordingly. Only one delivery method at this stage. But I don't want to show every country just the places we will deliver to… for some reason I can't uncheck to disable any countries from the list either?
Does that make sense?
That's currently done by setting the delivery address. The zone is then automatically chosen based on that address.
OK I've tried to just list the country list part of the delivery address form on the cart page, but this still doesn't update the shipping price. This is crucial to the project happening, please could you give me some code guidance to get this working? I'm sure this would be beneficial to others as well. Would really appreciate your help here.
Are you on the current version of Shop?
Was on 1.2.1 now 1.2.2 :o) and 3.0.8 perch runway running locally
This is the order flow I currently have working (except changing shipping cost based on country/zone selected):
To confirm, it's still an issue with the update? We made some changes around this in the newest version.
Yes still an issue. But I'm not totally sure that I'm using the right code?
in cart.php:
in custom template set_delivery_location.html:
It displays ALL countries I select Guernsey (which is more expensive than the UK) click ok page refreshes but no price change on the shipping price displayed in the cart. I also can't disable all the countries except the ones we will deliver too.
Drew, I've had to change setup now to get the project moved forward, I've moved the shipping cost code now from Cart to Checkout after the address input and the shipping price based on zone updates whichever zone is selected :o) Just would of been nice if it could of been done upfront at Cart level. Thanks for your help anyway.