Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim 43 posts 197 karma points
    Sep 23, 2020 @ 12:02
    Tim
    0

    Country Conditional Delivery

    I have a couple of questions about delivery! We have a site where we are currently using the Invoicing provider to allow free delivery of free product samples.

    The client are going to start charging for delivery of the samples, and I have a few questions. The site is in English, but allows for delivery to UK or Ireland only.

    1) Is it possible to have different delivery costs depending on the country for the order?

    2) Is it possible to switch the currency of the order depending on whether they select UK (GBP) or Ireland (EUR) for the delivery country?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 23, 2020 @ 12:36
    Matt Brailsford
    100

    Hey Tim,

    1) Yes, you can provide different prices for different countries for a shipping method. In the shipping method editor, go to the "Available in these countries" tab and allow the shipping method in the UK and Ireland. Against these, you can click the "custom prices" link to provide custom pricing for each country.

    enter image description here

    2) There is nothing automatic that does this, but what you would generally want to do is create a country / currency selector that usually appears at the top of the site and display the two options. When the option is changed, then you can update the payment country of the order using the TC API https://docs.teacommerce.net/3.4.0/api/country/#setcurrentpaymentcountry This should then cause it to select the appropriate shipping price.

    Hope this helps

    Matt

  • Tim 43 posts 197 karma points
    Sep 23, 2020 @ 13:51
    Tim
    0

    Thanks Matt!

    That's worked like a charm. I have one other issue though, are you aware of anything that would cause the shipping method not to get set when using the HTML API?

    I have several hidden fields like this:

    <input name="SetCurrentPaymentCountry" value="countryId" type="hidden" />
    <input name="SetCurrentShippingCountry" value="countryId" type="hidden" />
    <input name="SetCurrentShippingMethod" value="chipShippingMethod" type="hidden" />
    <input name="chipShippingMethod" value="@TC.GetShippingMethods(commerceSettings.StoreId).FirstOrDefault(a => a.Alias == "chipDelivery").Id" type="hidden" />
    

    For some reason the shipping method is not getting set, looking in the back office it's just empty. If I take the fields for that out, the default shipping method is assigned. Everything else is getting assigned as expected.

    The hidden field is getting a shipping method id (2 in this case), but it's not being set against the order for some reason.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 23, 2020 @ 14:03
    Matt Brailsford
    1

    I think you need to change your SetCurrentShippingMethod input to be

    <input name="SetCurrentShippingMethod" value="shippingMethodId : chipShippingMethod" type="hidden" />
    

    Or change that and the line after to be:

    <input name="SetCurrentShippingMethod" value="shippingMethodId" type="hidden" />
    <input name="shippingMethodId" value="@TC.GetShippingMethods(commerceSettings.StoreId).FirstOrDefault(a => a.Alias == "chipDelivery").Id" type="hidden" />
    

    Matt

  • Tim 43 posts 197 karma points
    Sep 23, 2020 @ 14:20
    Tim
    0

    Thanks Matt! Renaming the hidden field worked, it's now setting the currency and the shipping method correctly, thank you very much :)

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 23, 2020 @ 14:22
    Matt Brailsford
    0

    No problem at all.

    Glad we could get you all up and running. 👍

Please Sign in or register to post replies

Write your reply to:

Draft