lundi 2 mai 2016

Woocommerce: Losing currency in ajax call

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


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire