• Hello,

    If products are set to include taxes, the tips is calculated without tax! There should be an option to include / exclude this as the usual tips is for the full ammount of the order!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Eduard “RwkY” Doloc

    (@rwky)

    for anyone looking to fix this before an update arrives:
    plugin root/includes/class-frontend.php:283

    inside function “apply_tips” at this “if” condition:
    if ( strpos( $value, '%' ) !== false ) {

    update the code as follows:
    $cart_subtotal_value = WC()->cart->get_subtotal();
    $tax_totals = WC()->cart->get_tax_totals();
    $total_tax_amount = 0.0;

    foreach ( $tax_totals as $tax ) {
    $total_tax_amount += $tax->amount;
    }

    $amount_incl_tax = $cart_subtotal_value + $total_tax_amount;
    $amount = ( (float) $value / 100 ) * $amount_incl_tax;

    I was not able to find in documentation how to hook and overwrite this calculation, so keep in mind that this is a in-plugin update, this means that upon next update it?will be deleted (and might need re-applied) ti’ll authors will add this feature!

    Plugin Support Janilyn T

    (@janilyn409)

    Hi Rwky,

    Thanks for the information. I have sent it to our developers for further considerations. Please check back later with a newer update of this plugin.

    Best regards.

    shadrix

    (@shadrix)

    My update looks like this:

    if ( strpos( $value, '%' ) !== false ) {
      // I don't know why but WC()->cart->get_total('raw') is not working!
      $amount = ((float) $value / 100) * (WC()->cart->get_cart_contents_total() + WC()->cart->get_cart_contents_tax());
    } else {
      $amount = (float) $value;
    }

    For the developer would be awesome if you have a global setting:

    $use_gross_total = true;
    if ($use_gross_total) { $amount = ((float)$tip['value'] / 100) * WC()->cart->get_total(); } else { $amount = ((float)$tip['value'] / 100) * WC()->cart->get_subtotal(); }


    However I don’t know why the total function is not working even with ‘raw

    • This reply was modified 11 months ago by shadrix.
    • This reply was modified 11 months ago by shadrix.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘no option for taxes’ is closed to new replies.