Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter edoardo90

    (@edoardo90)

    ID Status
    #174210

    Thread Starter edoardo90

    (@edoardo90)

    Also I want it to not give cashback on the shipping payment. For that I used this code which worked perfectly as it gets the amount from the subtotal. The problem is that the discounted amount is after credits are aplied. Any way to eliminate cashback from shipping and when customer pays with credits?

    if (!function_exists(‘woo_wallet_form_cart_cashback_amount_callback’)) {
    function woo_wallet_form_cart_cashback_amount_callback($cashback_amount) {
    $cashback_rule = woo_wallet()->settings_api->get_option(‘cashback_rule’, ‘_wallet_settings_credit’, ‘cart’);
    $global_cashbak_type = woo_wallet()->settings_api->get_option(‘cashback_type’, ‘_wallet_settings_credit’, ‘percent’);
    $global_cashbak_amount = floatval(woo_wallet()->settings_api->get_option(‘cashback_amount’, ‘_wallet_settings_credit’, 0));
    $max_cashbak_amount = floatval(woo_wallet()->settings_api->get_option(‘max_cashback_amount’, ‘_wallet_settings_credit’, 0));
    if (‘cart’ === $cashback_rule) {
    if (‘percent’ === $global_cashbak_type) {
    $percent_cashback_amount = wc()->cart->get_subtotal(‘edit’) * ( $global_cashbak_amount / 100 );
    if ($max_cashbak_amount && $percent_cashback_amount > $max_cashbak_amount) {
    $cashback_amount = $max_cashbak_amount;
    } else {
    $cashback_amount = $percent_cashback_amount;
    }
    } else {
    $cashback_amount = $global_cashbak_amount;
    }
    }
    return $cashback_amount;
    }
    }

    Thread Starter edoardo90

    (@edoardo90)

    I got it done with the function

    add_filter(‘process_woo_wallet_general_cashback’, ‘process_woo_wallet_general_cashback_callback’, 10, 2);
    function process_woo_wallet_general_cashback_callback($process, $order){
    if(‘wallet’ === $order->get_payment_method(‘edit’)){
    return false;
    }
    return $process;
    }

    but when it is a mixed payment say for example 50% cash and 50% wallet credits it still gives cashback on the credits. Any way to not make that happen so customer only gets cashback on money spent and not credits spent?

Viewing 3 replies - 1 through 3 (of 3 total)