AutomateWoo – Refer A Friend add-on by woocommerce
Plugin link: https://woocommerce.com/products/automatewoo-refer-a-friend/
to file functions.php of the current WordPress theme add next code:
- To convert a credit:
add_filter('automatewoo/referrals/available_credit', function ($credit, $user_id) { if (class_exists('WOOCS') AND $credit > 0) { global $WOOCS; $credit = $WOOCS->woocs_exchange_value(floatval($credit)); } return $credit; }, 10, 2);
- To convert a coupon:
add_filter('automatewoo/referrals/coupon_data', function ($coupon_data, $coupon_code, $advocate_id, $coupon_object) { if (class_exists('WOOCS') AND $coupon_data['amount'] > 0) { global $WOOCS; $coupon_data['amount'] = wc_format_decimal($WOOCS->woocs_exchange_value(floatval($coupon_data['amount'])), 2); } return $coupon_data; }, 10, 4); add_filter('automatewoo/referrals/account_tab_title', function ($title) { if (class_exists('WOOCS')) { global $WOOCS; $WOOCS->current_currency = $WOOCS->default_currency; } return $title; }, 10);