Content of the page

WooCommerce – PayU Latam Gateway

Content of the article

  • WooCommerce - PayU Latam Gateway
    • open woocommerce-gateway-payulatam.php
    • find function __construct()
    • instead of:
      $this->currency = ($this->is_valid_currency()) ? get_woocommerce_currency() : 'USD';

      add next code:

      if (class_exists('WOOCS'))
      {
          global $WOOCS;
          $curr = strtoupper($WOOCS->storage->get_val('woocs_current_currency'));
      } else
      {
          $curr = get_woocommerce_currency();
      }
      
      
      $this->currency = ($this->is_valid_currency()) ? $curr : 'USD';

      find function is_valid_currency() and replace all code to the next code:

      function is_valid_currency()
      {
          if (class_exists('WOOCS'))
          {
              global $WOOCS;
              $curr = strtoupper($WOOCS->storage->get_val('woocs_current_currency'));
          } else
          {
              $curr = get_woocommerce_currency();
          }
          //+++
          if (!in_array($curr, apply_filters('woocommerce_payulatam_supported_currencies', array('ARS', 'BRL', 'COP', 'MXN', 'PEN', 'USD'))))
              return false;
      
          return true;
      }