Forum

Thread tagged as: Question, Shop

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: http://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?

Mark Watts

Mark Watts 0 points

  • 2 weeks ago
Drew McLellan

Drew McLellan 2251 points
Perch Support

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?

Drew McLellan

Drew McLellan 2251 points
Perch Support

Yes, it's something we're looking into.

Drew McLellan

Drew McLellan 2251 points
Perch Support

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:

https://docs.grabaperch.com/addons/shop/shipping/
In the Price to customer section, you can specify the price the customer is charged for the shipping method according to the shipping zone. Each shipping zone is listed, along with an available checkbox to activate and deactivate the shipping method for the specified zone.

Added this to the cart page:

    // Show the country list
    perch_shop_registration_form([
        'template' => 'cart/set_delivery_location.html'
    ]);

and this is the custom template:

<perch:form id="register" method="post" app="perch_shop">

    <h2>Set delivery location</h2>

    <fieldset>
        <legend>Choose from available delivery areas:</legend>
        <div>
            <perch:label for="country">Country</perch:label>
            <perch:input type="select" options="<perch:shop id="country_list" />" value="236" id="country" label="Country" />
        </div>

    </fieldset>
        <div>
            <perch:input type="submit" value="OK!" />
            <perch:input type="hidden" id="r" />
        </div>

</perch:form>

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?

Drew McLellan

Drew McLellan 2251 points
Perch Support

That's currently done by setting the delivery address. The zone is then automatically chosen based on that address.