I have a Woocommerce site that uses the Woocommerce Multilingual plugin from WPML to handle currencies. I am trying to get the cart amount in an AJAX-call, but I get wrong currency for some reason. If I use the same method (get_cart_subtotal) in a page template the correct currency is used.
Here is my very simple ajax-action:
add_action('wp_ajax_nopriv_get_cart_total', function(){
global $woocommerce;
echo $woocommerce->cart->get_cart_subtotal();
});
I am using:
- WooCommerce 2.5.5
- WPML Multilingual CMS 3.3.8 WooCommerce
- Multilingual 3.7.13
Try to use wc_ajax instead of wp_ajax. Change also code in .js – it could be something like that: