This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woo_wallet_credit_purchase_amount', 'woo_wallet_credit_purchase_amount_callback', 10, 2); | |
function woo_wallet_credit_purchase_amount_callback($recharge_amount, $order_id) { | |
$order = wc_get_order($order_id); | |
$recharge_amount = $order->get_subtotal('edit'); | |
if ('on' === woo_wallet()->settings_api->get_option('is_enable_gateway_charge', '_wallet_settings_credit', 'off')) { | |
$charge_amount = woo_wallet()->settings_api->get_option($order->get_payment_method(), '_wallet_settings_credit', 0); | |
if ('percent' === woo_wallet()->settings_api->get_option('is_enable_gateway_charge', '_wallet_settings_credit', 'percent')) { | |
$recharge_amount -= $recharge_amount * ($charge_amount / 100); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woo_wallet_amount', 'woo_wallet_amount_callback', 10, 2); | |
add_filter('woo_wallet_current_balance', 'woo_wallet_current_balance_callback', 10, 2); | |
if (!function_exists('woo_wallet_current_balance_callback')) { | |
function woo_wallet_current_balance_callback($balance, $user_id) { | |
$credit_amount = $debit_amount = 0; | |
$credit_array = get_wallet_transactions(array('user_id' => $user_id, 'where' => array(array('key' => 'type', 'value' => 'credit')), 'nocache' => true)); | |
foreach ($credit_array as $credit) { | |
$credit_amount += get_terawallet_converted_amount($credit->amount, $credit->currency); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('process_woo_wallet_general_cashback', 'process_woo_wallet_general_cashback_callback', 10, 2); | |
function woo_wallet_general_cashback_amount($precess, $order){ | |
if('cod' === $order->get_payment_method('edit')){ | |
return false; | |
} | |
return $precess; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_paypal_args', 'woocommerce_paypal_args_callback', 10, 2); | |
function woocommerce_paypal_args_callback($args, $order) { | |
if (isset($args['shipping_1']) && get_post_meta($order->get_id(), '_via_wallet_payment', true)) { | |
$_original_order_amount = get_post_meta($order->get_id(), '_original_order_amount', true); | |
$_via_wallet_payment = get_post_meta($order->get_id(), '_via_wallet_payment', true); | |
$via_paypal = $_original_order_amount - $_via_wallet_payment; | |
if ($args['shipping_1'] > $via_paypal) { | |
$args['shipping_1'] = $via_paypal; | |
$item_name = _get_order_item_names($order); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woo_wallet_current_balance', 'woo_wallet_current_balance', 10, 2); | |
if(!function_exists('woo_wallet_current_balance')){ | |
function woo_wallet_current_balance($balance, $user_id){ | |
$credit_amount = array_sum(wp_list_pluck(get_wallet_transactions(array('user_id' => $user_id, 'where' => array(array('key' => 'type', 'value' => 'credit')), 'nocache' => true)), 'amount')); | |
$debit_amount = array_sum(wp_list_pluck(get_wallet_transactions(array('user_id' => $user_id, 'where' => array(array('key' => 'type', 'value' => 'debit')), 'nocache' => true)), 'amount')); | |
$balance = $credit_amount - $debit_amount; | |
return $balance; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('init', 'init_woo_wallet_hooks'); | |
function init_woo_wallet_hooks(){ | |
if(!is_admin() && class_exists('Woo_Wallet_Frontend')){ | |
remove_action('woocommerce_before_single_product_summary', array(Woo_Wallet_Frontend::instance(), 'display_cashback'), 15); | |
add_action('woocommerce_single_product_summary', array(Woo_Wallet_Frontend::instance(), 'display_cashback'), 15); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function woo_mini_wallet_callback() { | |
if (!function_exists('woo_wallet') || !is_user_logged_in()) { | |
return ''; | |
} | |
ob_start(); | |
$title = __('Current wallet balance', 'woo-wallet'); | |
$mini_wallet = '<a class="woo-wallet-menu-contents" href="' . esc_url(wc_get_account_endpoint_url(get_option('woocommerce_woo_wallet_endpoint', 'woo-wallet'))) . '" title="' . $title . '">'; | |
$mini_wallet .= '<span class="woo-wallet-icon-wallet"></span>'; | |
$mini_wallet .= woo_wallet()->wallet->get_wallet_balance(get_current_user_id()); | |
$mini_wallet .= '</a>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wallet_credit_purchase_order_status', 'wallet_credit_purchase_order_status'); | |
function wallet_credit_purchase_order_status($status){ | |
$status = array('completed'); | |
return $status; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_available_payment_gateways', 'woocommerce_available_payment_gateways_callback'); | |
if(!function_exists('woocommerce_available_payment_gateways_callback')){ | |
function woocommerce_available_payment_gateways_callback($_available_gateways){ | |
if(isset($_available_gateways[ 'bacs' ]) && is_enable_wallet_partial_payment()){ | |
unset($_available_gateways[ 'bacs' ]); | |
} | |
return $_available_gateways; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!function_exists('woocommerce_available_payment_gateways_callback')){ | |
function woocommerce_available_payment_gateways_callback($_available_gateways){ | |
if(!is_admin() && !is_wallet_rechargeable_cart()){ | |
foreach ($_available_gateways as $id => $gateway){ | |
if('wallet' != $id){ | |
unset($_available_gateways[$id]); | |
} | |
} | |
} | |
return $_available_gateways; |
OlderNewer