• Resolved Alireza Bahrami

    (@teacherbahrami)


    Hi
    How can I set the plugin for the following scenario?

    product price: 100$
    credit already on customer wallet: 10%
    real money paid by customer: 90%
    cashback: 15% on 90$ paid

    currently cashback is set for 100$ which is the product price not the money paid by the customer.

    Could you think of a solution for this?

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

    (@subratamal)

    @teacherbahrami You can customise cashback calculation using filter woo_wallet_form_cart_cashback_amount.

    Thread Starter Alireza Bahrami

    (@teacherbahrami)

    Thank you,
    Could you tell me how to use this filter?

    Thread Starter Alireza Bahrami

    (@teacherbahrami)

    I appreciate if you help me out with this

    Thread Starter Alireza Bahrami

    (@teacherbahrami)

    @subratamal I appreciate if you help me out with this

    Plugin Author Subrata Mal

    (@subratamal)

    @teacherbahrami Please reach out to us at our support email [email protected] regarding this topic.

    Thanks

    Hi,

    I love the plugin but I also need a solution to this, would appreciate if you could share any resolution for this.

    Basically I need the following calculation for cashback:

    cashback amount =
    [ cost of product (inc tax) – any discounts – shipping cost – wallet credit ] * cashback %

    Could you help? Thanks so much!

    Hi, Ignore my previous request. I’ve already got a working solution. Just ensure you have CODE SNIPPETS plugin installed so you can add the code into the function.php without touching the original.

    Create a new snippet and paste the following code and activate.

    This calculates:
    ? Amount of purchase including taxes and discounts
    ? Minus any Wallet balance (when the setting for using wallet amount to offset purchase is set)
    ? also excludes Shipping fees being calculated for a cashback

    ——————————

    add_filter(‘woo_wallet_form_cart_cashback_amount’, ‘woo_wallet_form_cart_cashback_amount_callback’, 10);

    function woo_wallet_form_cart_cashback_amount_callback($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));
    $global_wallet_balance = woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), ‘edit’ );
    if (‘percent’ === $global_cashbak_type) {
    $cashback_amount = $cashback_amount = (wc()->cart->get_subtotal() + wc()->cart->get_subtotal_tax()- $global_wallet_balance) * ($global_cashbak_amount / 100);
    }
    return $cashback_amount;
    }

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cashback on bank gateway’ is closed to new replies.