Tax calculation solution not working with new update2019-05-28T17:11:58+05:30

Home Forums Core Tax calculation solution not working with new update

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • robert
    Participant
    Post count: 1

    https://wordpress.org/support/topic/cashback-base-of-price-incl-taxes/
    cashback – base of price incl. taxes

    Need solution for this for the latest version.

    The following code does not work anymore

    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;
    }

    Subrata Mal
    Keymaster
    Post count: 207

    Use below updated code.

    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));
    if (‘percent’ === $global_cashbak_type) {
    $cashback_amount = (wc()->cart->get_subtotal() + wc()->cart->get_subtotal_tax()) * ($global_cashbak_amount / 100);
    }
    return $cashback_amount;
    }

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
WhatsApp