Copied to clipboard

Flag this post as spam?

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


  • Arun 141 posts 404 karma points
    Jun 15, 2020 @ 17:58
    Arun
    0

    Unable to set Current Currency

    Hi Matt,
    I was trying to set currency based on the current culture.
    I tried TC.SetCurrentCurrency(store-ID, currency-ID) but the values are not changing as i can see TC.GetCurrentCurrency(store-ID) returns old currency.
    Which are the occasions where its unable to update current currency? How can i solve this?
    -Arun

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 16, 2020 @ 08:25
    Matt Brailsford
    0

    Hey Arun,

    It might be worth looking in your cookies at the teacommerce_* cookie and seeing if the currentCurrencyId value is the on you expect. If that is the case, then the value is getting set, but maybe something it preventing the order being updated with the value.

    Do you have any event handlers that might be resetting the orders currency back to something else?

    /Matt

  • Arun 141 posts 404 karma points
    Jun 20, 2020 @ 13:41
    Arun
    0

    Hi Matt,
    I didn't see any event handler to reset the currency,
    after i tried TC.SetCurrentCurrency(store-ID, currency-ID) on the very next step i check the current currency with TC.GetCurrentCurrency(2); and see the new value is not updated. also var currency = TC.getCurrency({storeId:2}); in javascript seems not working.
    -Arun

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 20, 2020 @ 13:57
    Matt Brailsford
    0

    Sorry, but did you check your cookie values to see if they are being updated? As this is where the "current currency" gets stores if you don't have a current order.

  • Arun 141 posts 404 karma points
    Jun 24, 2020 @ 05:47
    Arun
    0

    Hi Matt
    The cookie value is not getting updated after switched the currency.
    I can see a cookie named _teacommerce-2_ having the content currentCurrencyId as 2 which is not changing after switching
    I cleared the cookie and reloaded and now i can see the correct currency.


    I tried deleting Dollar which is getting as default currency, and cleared cookies and loaded the page again but still i can see dollar being rendered.., also it get listed in currency section in countries enter image description here

    -Arun

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 24, 2020 @ 06:58
    Matt Brailsford
    0

    Hmmm, this is pretty strange. What version of TC are you on? The latest?

  • Arun 141 posts 404 karma points
    Jun 24, 2020 @ 07:11
    Arun
    0

    We are using
    Tea Commerce 3.4.0
    and Tea Commerce Starter Kit 4.2.5
    in Umbraco 7

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 24, 2020 @ 07:27
    Matt Brailsford
    0

    You say your cookie name was “teacommerce-2”? If so this would suggest your store ID is 2, but in the code snippets you’ve shown, you are passing a store ID of 1. Could this be the issue?

  • Arun 141 posts 404 karma points
    Jun 24, 2020 @ 07:31
    Arun
    0

    No..I tried with 2 which is my store ID.
    Sorry for the confusion i just took that code from the documentation.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 24, 2020 @ 08:16
    Matt Brailsford
    0

    Ok, just checked the code again and one thing that could prevent it from being set is if the currency isn't allowed in either the current orders payment country, or where there is no current order, in the sessions current payment country.

    Could you check if you have an order, what it's payment country is, or if not, what the sessions default country is and then ensure that the currency you want to switch to is allowed in that given country.

    This is controlled in the currencies admin screen on the "Available in these countries" tab.

    /Matt

  • Arun 141 posts 404 karma points
    Jun 25, 2020 @ 04:31
    Arun
    0

    Yes...feel like this error is due the improper handling of currency and countries
    I have given all currencies in all countries, but dollar is being my current currency.!

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 25, 2020 @ 06:59
    Matt Brailsford
    0

    Then I'm struggling to think what else to suggest.

    As I say, the only thing that prevents a currency being set as current currency is if it's not allowed in the orders / current payment countries country.

    Do you have a current order? If so, can you identify what payment country it is set to and tell me? If you don't, can you tell me what GetCurrencyPaymentCountry is telling you is the current country? Can you then show me a screenshot of that countries admin screen? And then for the currency you want to change to, can you show me a screenshot of it's admin screen, clearly showing it's allowed in that country? Can you then show me the EXACT code you are using to set the currency?

    /Matt

  • Arun 141 posts 404 karma points
    Jun 25, 2020 @ 15:49
    Arun
    0

    Hi Matt,
    When i tried delete the currency which shown incorrectly and recreated the error gone sureprisingly. I didn't get what happened.!
    Now it seems resolved

    also this is how i set the currency, enter image description here
    sometimes have seen the cookie doesn't get updated.! Can i handle that manually?
    -Arun

Please Sign in or register to post replies

Write your reply to:

Draft