businessdad icon

WooCommerce Extended Coupon Features - Convert thresholds

businessdad | PRO | 01/22/20 05:58:02 PM UTC | 0 ⭐ | 996 👁️ | Never ⏰ | []
PHP |

1.78 KB

|

None

|

0 👍

/

0 👎

/**
 * WooCommerce Extended Coupon Features
 * The following example shows how to convert the minimum and maximum matching products subtotals
 * assigned to a coupon by using the filters provided by the Aelia Currency Switcher.
 *
 * DISCLAIMER
 * Aelia and any member of its staff are not responsible for any data loss or damage incurred
 * when using the code, which you can use at your own risk.
 *
 * GPL DISCLAIMER
 * Because this code program is free of charge, there is no warranty for it, to the extent permitted by applicable law.
 * Except when otherwise stated in writing the copyright holders and/or other parties provide the program "as is"
 * without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of
 * merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program
 * is with you. should the program prove defective, you assume the cost of all necessary servicing, repair or correction.
 *
 * Need a consultation, or assistance to customise this code? Find us on Codeable: https://aelia.co/hire_us
 */
 
function convert_amount_from_base_currency($amount, $to_currency) {
  if(is_numeric($amount)) {a
    $amount = apply_filters('wc_aelia_cs_convert', $amount, get_option('woocommerce_currency'), $to_currency);
  }
  return $amount;
}
 
add_filter('woocommerce_coupon_get__wjecf_min_matching_product_subtotal', function($value, $coupon) {
  $value = convert_amount_from_base_currency($value, get_woocommerce_currency());
  return $value;
}, 10, 2);
 
add_filter('woocommerce_coupon_get__wjecf_max_matching_product_subtotal', function($value, $coupon) {
  $value = convert_amount_from_base_currency($value, get_woocommerce_currency());
  return $value;
}, 10, 2);

Comments