Home › Forums › WoodMart support forum › Dynamic discount – fixed discount tax is missing
Dynamic discount – fixed discount tax is missing
- This topic has 8 replies, 2 voices, and was last updated 1 year ago by
Artem Temos.
-
AuthorPosts
-
July 9, 2024 at 2:33 pm #582119
MarcoParticipantWe try to use the dynamic discount table with a fixed discount but the discount value shows without tax included.
We use net prices in the backend and show gross prices in the frontend.
The discount table shows only the net discount, but should display a gross price.
Is there any chance to display the column discount with gross price? maybe a code snippet?Thanks
July 9, 2024 at 3:07 pm #582141
MarcoParticipanteg. The Product gross Price is 279,00 €
In the in the backend discount table I added
from 2 to 2 fixed discount 4,20 (net discount)
In the frontend the table shows
2 Price per unit 274,00 (gross price) Discount 4,20 (net discount)
Instead of showing the net discount 4,20 it should display the gross discount 5,00Hope it is clear now what I mean
July 9, 2024 at 3:20 pm #582146
Artem TemosKeymasterHello,
Please provide us with your admin access so we can log in and check this on your end.
Thank you in advance.
July 9, 2024 at 5:24 pm #582182
MarcoParticipantFind the Login Data in the private section
July 9, 2024 at 5:32 pm #582184
Artem TemosKeymasterSorry, but we can’t enter your dashboard with the URL provided.
July 9, 2024 at 5:59 pm #582190
MarcoParticipantSoory, we use 2FA, I’ve disabled it temporary, please try again
July 10, 2024 at 2:05 pm #582394
Artem TemosKeymasterTry to edit the file
wp-content\themes\woodmart\inc\integrations\woocommerce\modules\dynamic-discounts\class-frontend.php
and replace the code'value' => 'amount' === $rules['_woodmart_discount_type'] ? apply_filters( 'woodmart_pricing_amount_discounts_value', $rules['_woodmart_discount_amount_value'] ) : $rules['_woodmart_discount_percentage_value'],
with this
'value' => 'amount' === $rules['_woodmart_discount_type'] ? apply_filters( 'woodmart_product_pricing_amount_discounts_value', $rules['_woodmart_discount_amount_value'] ) : $rules['_woodmart_discount_percentage_value'],
And after this, add the following snippet to the function.php file in your child theme
add_filter( 'woodmart_pricing_amount_discounts_value', function ( $discount ) { global $product; if ( ! $product || ! wc_tax_enabled() || 'incl' !== get_option( 'woocommerce_tax_display_shop' ) ) { return $discount; } $tax_rates = WC_Tax::get_rates( $product->get_tax_class() ); $taxes = WC_Tax::calc_tax( $discount, $tax_rates, false ); if ( 'yes' === get_option( 'woocommerce_tax_round_at_subtotal' ) ) { $taxes_total = array_sum( $taxes ); } else { $taxes_total = array_sum( array_map( 'wc_round_tax_total', $taxes ) ); } $discount_price = $discount + $taxes_total; if ( ! is_numeric( $discount_price ) ) { $discount_price = floatval( $discount_price ); } $discount_price = round( $discount_price, wc_get_price_decimals() ); return $discount_price; } );
July 10, 2024 at 6:40 pm #582498
MarcoParticipantThanks for your fast and reliable support.
It works perfect!July 11, 2024 at 9:35 am #582574
Artem TemosKeymasterYou are welcome. Feel free to contact us if you have any further questions.
-
AuthorPosts
The topic ‘Dynamic discount – fixed discount tax is missing’ is closed to new replies.
- You must be logged in to create new topics. Login / Register