Multi currency store not always showing correct currency

alextorresalextorres Member
in Bugs & Feature Requests edited October 10
Hello,

we have a multi currency store set up with with template_sets, one for US with $ and one for UK with £. We also always specify currency in the buy buttons.

The site uses Geo-location to know where the customer is, so the price in the buy buttons will show $ or £ depending on the IP of the customer. This works consistently.

The problem is that sometimes a customer from the US will see $ in the product details page, press buy and they will see £ in the cart. The amount is converted to what the price would be in £, but it should be showing $ in the cart.

Is this a known issue? How can we fix it so the currency used in the cart is consistent to what is show on the website?

Best,
Comments
  • brettbrett FoxyCart Team
    Hi @alextorres.
    That's very strange. It's certainly not a known issue. The only way this should be able to happen is if your site isn't sending through the correct template_set parameter when a customer adds to cart.

    Are you able to consistently reproduce this at all? Are there multiple methods you use to create add-to-cart links/forms? Or perhaps is it a situation where your system doesn't get data correctly (like an unknown country due to a proxy), and it's defaulting one way on your site but another way in Foxy?

    I'd focus on how that param gets sent, because that's the only thing that makes sense.

    Barring figuring out the actual issue, you could look at the JSON response for the Foxy session after it loads, and if there's a mismatch, fire off a request to set the template_set.
  • Hello @brett

    we set the template in the buy button, like this

    <a class="button button-buy" href="https://secure.plutobooks.com/cart?price||7c081db705cb786b32aaced5afb80daee01a8cefd5c4fff17121b35a0babe10c=14.99gbp&amp;code||c1bf7ac3f1bca4874f2d45266eaf77569f5b868642ba995d0e76dc3397a282b2=9780745399409&amp;name||f0c8d545b7c28770e4b2c685d99164d85354231989af1580621009db9fc0788f=The+Death+of+Homo+Economicus&amp;Format||bdb3fb685dd05cf74f7ac32795236094051d89b9a24f07671e3ceeee53c3474d=Paperback&amp;image||4e7b97c27df75f439250378519056eddc783525c1335d90e7404de4fd9ceba98=https%3A%2F%2Fd28akss8xdipta.cloudfront.net%2Fresized%2Fwidth-298%2Fpath-assets%2Fcovers%2Fv2%2F9780745399409.jpg&amp;category||ee063298050bb4ce0b0d69c1ee1ef4f7888aad4e430f951f5850de034ecf1e3b=physical&amp;width||242d6f37b49a5ce771742d9b3e9226f26246c37af5c5e6c4aa362003db09f6bd=135.000&amp;height||65ae3ff7b82cd6255194215740e8de2c19f3bce8457863fc4fcd5e3227bb6b11=215.000&amp;weight||146fd8aaf942bda0e2edb53c66b8f392355e6cc2bc512c58e929d3e948b4f6a9=0&amp;&amp;fcsid=e78qtvccv2917s4fassg3okq64" onclick="FC.client.request('https://'+FC.settings.storedomain+'/cart?template_set=gbp');">BUY</a>

    when that button is pressed, we get this response

    /**/jQuery11240434993978872094_1507713258799({"language":"english","locale_info":{"decimal_point":".","thousands_sep":"","int_curr_symbol":"GBP ","currency_symbol":"\u00a3","mon_decimal_point":".","mon_thousands_sep":",","positive_sign":"","negative_sign":"-","int_frac_digits":2,"frac_digits":2,"p_cs_precedes":1,"p_sep_by_space":0,"n_cs_precedes":1,"n_sep_by_space":0,"p_sign_posn":1,"n_sign_posn":1,"grouping":[],"mon_grouping":[3,3],"int_p_sep_by_space":0,"int_n_sep_by_space":0},"locale_code":"en_GB","template_set":"gbp","weight_uom":null,"context":"cart","store_id":43809,"transaction_id":1353933853,"items":[],"item_count":0,"multiship_data":[],"total_discount":0,"total_shipping":0,"total_tax":0,"total_item_price":0,"total_order":0,"total_weight":0,"total_weight_shippable":0,"total_future_weight_shippable":0,"total_future_shipping":0,"total_future_item_price":0,"is_future_shipping_only":false,"has_future_live_rate_shipping":false,"has_future_flat_rate_shipping":false,"has_current_live_rate_shipping":false,"has_current_flat_rate_shipping":false,"future_subscription_totals_by_date":[],"show_future_subscriptions_details":false,"session_id":"e78qtvccv2917s4fassg3okq64","session_name":"fcsid","cart_cancel_and_continue_link":"https:\/\/www.plutobooks.com\/9780745399409\/the-death-of-homo-economicus\/","expires_in":0,"coupons":[],"show_coupon_input_button":false,"future_coupons":[],"custom_fields":[],"messages":{"errors":[],"warnings":[],"info":[]},"is_updateinfo":false,"has_product_images":false,"loading_coupons":false,"loading_taxes":false,"taxes_calculated":false,"loading_quantity":false,"shipping_address":{"first_name":null,"last_name":null,"company":null,"tax_id":null,"address1":null,"address2":null,"city":null,"region":null,"city_and_region":", ","region_name":"","region_label":"County","postal_code":null,"country":"GB","country_name":"United Kingdom","phone":null,"shipping_service_description":"","shipping_service_id":0,"shipping_service_signature":"","city_options":[],"city_option_selected":"","loading_shipping_results":false,"has_shippable_products":false,"has_live_rate_shippable_products":false,"future_shipping_service_description":"Shipping & Handling","address_name":"","type":"shipping","prefix":"shipping","total_shipping":0,"total_future_shipping":0,"total_tax":0,"total_item_price":0,"total_future_item_price":0,"shipping_results":[],"taxes":[],"future_taxes":[]},"has_multiship":false,"has_multiple_addresses":false,"show_multiship_details":false,"show_shipping_tbd":false,"shipping_and_handling_label":"Handling","show_paypal_express_payment_option":false,"show_amazon_fps_payment_option":false,"order_payment_options":[],"has_location_dependent_taxes":false,"has_future_products":false,"has_future_shipping":false,"has_eligible_coupons":true,"has_subscriptions":false,"is_new_subscription":false,"is_subscription_cancel":false,"is_subscription_modification":false,"has_taxes":false,"has_future_taxes":false,"show_address_entry":false,"payment_info_required":false,"cart_config_hash":"9cd8a1513d43ba6a967059547788b1cc","config":{"lang":{"cart_add_coupon":"Add Coupon","cart_apply":"Apply","cart_calculate":"Calculate","cart_calculate_shipping":"Calculate Shipping","cart_calculate_taxes":"Calculate Taxes","cart_cancel_and_continue":"Cancel and Continue Shopping","cart_caption":"Your Cart","cart_category":"Category","cart_change":"Change","cart_checkout":"Proceed to Checkout","cart_code":"Code","cart_coupon_code":"Coupon Code","cart_details":"Details","cart_discounts":"Discounts","cart_each":"each","cart_end_date":"End Date","cart_empty":"Your shopping cart is empty. Click here to return to the store.","cart_error_postal_code":"We could not find that postal code.","cart_error_postal_code_lookup":"We do not currently allow orders from this region.","cart_error_title":"Oops. There was a problem.","cart_frequency":"Frequency","cart_future_charge":"Next Charge","cart_future_charges":"Next Charges","cart_hide_coupon_input":"Hide Coupon Input","cart_in_your_order":"in your order","cart_item":"Item","cart_items":"Items","cart_keep_shopping":"Keep Shopping","cart_next_date":"Next Date","cart_no_javascript_message":"Our checkout process requires javascript. Please \u003Ca href=\"http:\/\/www.google.com\/support\/bin\/answer.py?answer=23852\" target=\"_blank\"\u003Eclick here to enable javascript\u003C\/a\u003E. You may then click the checkout button below, or refresh this page to make changes to your cart.","cart_notice_quantity_max":" is greater than the maximum allowed quantity. The quantity has been adjusted accordingly.","cart_notice_quantity_min":" is less than the minimum allowed quantity. The quantity has been adjusted accordingly.","cart_or":"or","cart_order_summary":"Order Summary","cart_order_total":"Order Total","cart_price":"Price","cart_qty":"Qty","cart_quantity":"Quantity","cart_remove_item":"Remove this item","cart_shipping_to":"Shipping to...","cart_shipping_and_handling":"Shipping & Handling","cart_shipto":"Ship To: ","cart_shipto_default":"Me","cart_start_date":"Shipping Date","cart_subscription_details":"Pre-order Details","cart_subtotal":"Subtotal","cart_tax":"Tax","cart_tbd":"TBD","cart_todays_charge":"Today's Charge","cart_total":"Total","cart_warning":"Warning:","cart_weight":"Weight","checkout_city":"City","checkout_country":"Country","checkout_loading":"Loading...","checkout_location_state":"State","checkout_location_canton":"Canton","checkout_location_county":"County","checkout_location_other":"Other...","checkout_location_pincode":"PIN Code","checkout_location_postalcode":"Postcode","checkout_location_prefecture":"Prefecture","checkout_location_province":"Province","checkout_location_zipcode":"ZIP code","checkout_submit_postal_code":"Go!","email_order_number":"Order #"}}});

    but this is the result

    image


    As you can see, template_set is always passed as received as gbp, which is the code of the template set with £. There are no JS errors in the console, so the onclick should always be firing and the template should always be being set.

    Best,
  • fc_adamfc_adam FoxyCart Team
    @alextorres,

    Thanks for showing how you've got it set up. We'd recommend moving the template set parameter into your add to cart, instead of in the onclick as you have it currently. That way the template set will be applied at the exact same time as the product is being added - rather than in two separate requests. Could you try that and see if it gets it working as it should?
  • alextorresalextorres Member
    edited October 11
    Hello @fc_adam

    do you mean add it into

    https://secure.plutobooks.com/cart?template_set=gbp...

    in the buy button?

    Thanks
  • marijamarija FoxyCart Team
    Hi @alextorres -

    Yes, I believe that's what Adam meant. Let us know if that gets things working for you.
  • Hello

    I have now set the template_set in the cart call like so:

    https://dev-plutopress.foxycart.com/cart?price||74d35e7aa834096744cfdbb6e9fc97c0949329476d47962f798e88b14bdb22cc=16.99gbp&code||a651fe02404fcd240ec8acdfa127323ed852743ceb2e3d6c3a5d3c461c6021e4=9780745399218&name||83613fdf75f81c9213ba2a161b4e75b2a2eb44fb97d5ea0062ba84505c6529f0=Looking+to+London&Format||7052ca8cdfd70b8bb7721ab3aff90880eeb6c83ab11a27d2a4cb32f8d581bb11=Paperback&image||c116b2d302e8fe3e597420a0672f238daa52d0e247f1d37ce18d29a468ff6720=https%3A%2F%2Fd28akss8xdipta.cloudfront.net%2Fresized%2Fwidth-298%2Fpath-assets%2Fcovers%2Fv2%2F9780745399218.jpg&category||abc40580fd2847e6a1634c45cf9937457f45b6f115fed98c82b900dc4e6344cf=physical&width||5afcadfec86a528e1a8cd032a8fafb4cd7bac0faf16ef5c1675c52eccc08d4d2=135.000&height||6fdaac491dd25482ae786455098de042c40224fe52abf20949c148797e21caef=215.000&template_set||c7e5243c3098d0aba50fc9a33f77291dc0f0745ec8431dd4a2d237ba18f79337=gbp&weight||3bb36bc55882124db586c032d64f957fc233bbee6e37c59c5948ee6eb4f498f6=0&

    and I get this

    image


    I can see the tempate set as usd but the price is still showing as £

    Best
  • fc_adamfc_adam FoxyCart Team
    @alextorres,

    Thanks for the update and giving that a try - I think we might be misunderstanding your goal here though. The link you've pasted there will show as £ in the cart, as you're using a template set which is set to GBP as the currency, and you're passing a price also in GBP. If you're wanting to display a price in USD - then the add to cart would need to use a template set with a USD locale/currency and the price in USD as well.

    Is your add to cart page online somewhere public that we could access it to see what you're experiencing?

    Also as an aside - your images aren't loading for me in your posts, I believe it is due to a permission error related to the access permissions in your Google Drive account.
  • alextorresalextorres Member
    edited October 12
    @fc_adam sorry about the images, I thought I had set them to public, but I guess did it wrong

    I will make sure that the price and the template set have the same currency an get back to you
  • @fc_adam

    I've retested and this are my results:
    the button is
    https://dev-plutopress.foxycart.com/cart?price||221906ae904bb539e35d246dc9b340ba777cc08ca0e7b9aef0f30f85d051915b=24.00usd&code||a651fe02404fcd240ec8acdfa127323ed852743ceb2e3d6c3a5d3c461c6021e4=9780745399218&name||83613fdf75f81c9213ba2a161b4e75b2a2eb44fb97d5ea0062ba84505c6529f0=Looking+to+London&Format||7052ca8cdfd70b8bb7721ab3aff90880eeb6c83ab11a27d2a4cb32f8d581bb11=Paperback&image||c116b2d302e8fe3e597420a0672f238daa52d0e247f1d37ce18d29a468ff6720=https%3A%2F%2Fd28akss8xdipta.cloudfront.net%2Fresized%2Fwidth-298%2Fpath-assets%2Fcovers%2Fv2%2F9780745399218.jpg&category||abc40580fd2847e6a1634c45cf9937457f45b6f115fed98c82b900dc4e6344cf=physical&width||5afcadfec86a528e1a8cd032a8fafb4cd7bac0faf16ef5c1675c52eccc08d4d2=135.000&height||6fdaac491dd25482ae786455098de042c40224fe52abf20949c148797e21caef=215.000&template_set||00a9e12c53098b05c323a35c06fdf17683bac067e99000c643d0bc158ccf6aef=usd&weight||3bb36bc55882124db586c032d64f957fc233bbee6e37c59c5948ee6eb4f498f6=0&&fcsid=iealjo2krshettlcf6ubn1uon1

    price in usd, tempate_set also usd

    but I see this

    image


    you can access the cart here http://pluto-press-php.dev.wai.co.uk/9780745399218/looking-to-london/ when you click on the BUY button

    Best

  • fc_adamfc_adam FoxyCart Team
    @alextorres,

    Thanks for the link and the screenshot. I can see what's happening here, sorry for missing it earlier. You won't need to sign the template_set attribute in the add to cart. If you update that attribute to not being signed, that should get the add to cart working as you expect.

    I see you're using FoxyShop on your site - are using that plugin to sign the add to cart as well? Or are you signing it using your own functions? If you're using FoxyShop, it's currently not set to leave the template_set parameter alone. You can correct that by including this code in your functions.php file:
    add_filter( 'foxyshop_non_verification_fields', 'custom_non_verification_fields' );
    function custom_non_verification_fields( $fields ) {
    $fields[] = 'template_set';
    return $fields;
    }
  • alextorresalextorres Member
    edited October 13
    Hello @fc_adam

    we use our own functions, so I Just added template_set before the signing and that seems to have fixed the issue. I'll let you know if I have any more problems.

    Thank you for your help!
Sign In or Register to comment.