Support » Plugin: TeraWallet - For WooCommerce » cashback – base of price incl. taxes

  • Resolved makoer

    (@makoer)


    Hey,
    this is a so powerful plugin. Now, it’s possible to bind my customer better on my store.

    I think thers is a little problem in calculate the cashback.
    When I made tax adjustments the cashback is calculatet from net price and not from gross price.
    ———-
    adjusments:
    cart calculate
    10% cashback
    19% tax
    —————-
    calculation:
    119€ gross price
    100€ net price (119/1.19)
    10€ cashback, but 11.90€ is the right one.

    Please, let me know how I can fix it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    Hi @makoer,

    Thanks for reaching out to our support forum and thanks for your knowledgeable inputs. Gross price is the sum of net price + tax amount + shipping cost right? If we include tax amount for calculating cashback amount and what will be done to shipping cost please suggest.

    Looking forward to your co-operation regarding the same.

    Thanks and regards,
    Subrata Mal

    Plugin Author Subrata Mal

    (@subratamal)

    @makoer,

    For cashback incl taxes you can use below code snippet to your theme function.php file and let us know if this is works for your requirements.

    add_filter('woo_wallet_cashback_amount', 'woo_wallet_cashback_amount');
    
    function woo_wallet_cashback_amount($cashback_amount, $order_id) {
        if ($order_id) {
            return $cashback_amount;
        }
        $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));
        if ('percent' === $global_cashbak_type) {
            $cashback_amount = (wc()->cart->get_subtotal() + wc()->cart->get_subtotal_tax()) * ($global_cashbak_amount / 100);
        }
        return $cashback_amount;
    }

    Thanks and regards,
    Subrata Mal

    Thread Starter makoer

    (@makoer)

    @subratamal
    You are my man! The first tests show like it works!

    The gross price is: net price + taxes
    I think, shipping cost should not be calculated for cashback. They are only costs.

    regards,
    makoer

    Plugin Author Subrata Mal

    (@subratamal)

    Hi @makoer,

    Happy to hear from you that the issue has been resolved.

    I am marking this topic as resolved please feel free to create a new thread for any further queries.

    Could you please consider posting a review for our plugin? In addition to providing feedback, reviews can help other user to know who we are and what our plugin does.

    Cheers

    Plugin Author Subrata Mal

    (@subratamal)

    Hi @makoer,

    Sorry my mistake in the above code there is a glitch please use below updated code

    add_filter('woo_wallet_cashback_amount', 'woo_wallet_cashback_amount', 10, 2);
    
    function woo_wallet_cashback_amount($cashback_amount, $order_id) {
        if ($order_id) {
            return $cashback_amount;
        }
        $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));
        if ('percent' === $global_cashbak_type) {
            $cashback_amount = (wc()->cart->get_subtotal() + wc()->cart->get_subtotal_tax()) * ($global_cashbak_amount / 100);
        }
        return $cashback_amount;
    }
    Thread Starter makoer

    (@makoer)

    Hey, Subrata Mal,

    thanks for your comment.

    regards,
    makoer

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘cashback – base of price incl. taxes’ is closed to new replies.