Support for WCML

This topic contains 7 replies, has 2 voices, and was last updated by Jie Jie 5 years ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #13593
    Jie
    Jie
    Participant

    Hello,

    it seems the plugin is not compatible with WCML.

    I go to the advanced option and add the {titlefield} – {_price} to the title field. But I want it to show the multi prices in different languages (it only shows the price in original currency).

    Could you please make it possible? Or it does nothing to me.

    Thank you

    Jie

    Attachments:
    You must be logged in to view attached files.
    #13603
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you for the information!

    I’m not able to view the site, I’m getting an error page: “Your access to this site has been limited’
    Can you please check that?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #13604
    Jie
    Jie
    Participant

    Thank you.

    Now it should be accessible.

    Regards

    Jie

    #13610
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you!

    Can you please also check the FTP, I just tried to log-in, but I can only see an empty folder.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #13613
    Jie
    Jie
    Participant
    You cannot access this content.
    #13623
    Jie
    Jie
    Participant

    Thank you.

    It works fine.

    #13624
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    You are welcome. I’ve added a custom code to the functions.php file in your theme directory to make it work, please leave it there.I also had to modify the plugin code to recognize the current currency. I will make sure to add that modification to the upcoming release so you won’t have to worry about updates.

    For future reference, I leave the custom code here: https://gist.github.com/anag0/c26e263ab568fd4a790ce66ca522a384

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #13625
    Jie
    Jie
    Participant
    add_filter('asp_results', 'asp_display_price_w_currency', 10, 4);
    function asp_display_price_w_currency($results, $sid, $is_ajax, $args) {
      if ( empty($args['woo_currency']) )
        return $results;
      global $woocommerce;
      global $sitepress;
      global $woocommerce_wpml;
      $currency = $args['woo_currency']; // GET THIS FROM A PARAM
    
      foreach ($results as $k=>&$r) {
        if ( isset($r->post_type) &&
             in_array($r->post_type, array('product', 'product_variation'))
        ) {
          $p = wc_get_product( $r->id );
          $price = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $r->id, $currency );
          $r->title .= ' - ' . wc_price($price, array('currency' => $currency));
        }
      }
      return $results;
    }
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.