Skip to content

Commit

Permalink
Improved compatibility for Tiered Pricing Table for WooCommerce
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulsky committed Oct 19, 2024
1 parent a693e45 commit f263a0a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to the Wdevs Tax Switch plugin will be documented in this file.


## [1.1.4] - 2024-10-19
### Updated
- Improved compatibility for Tiered Pricing Table for WooCommerce

## [1.1.3] - 2024-10-15
### Added
- Compatibility for [Discount Rules for WooCommerce](https://wordpress.org/plugins/woo-discount-rules/)
Expand Down
9 changes: 6 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: wijnbergdevelopments
Tags: woocommerce, tax, vat
Requires at least: 5.0
Tested up to: 6.6
Stable tag: 1.1.3
Stable tag: 1.1.4
Requires PHP: 7.2
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Expand Down Expand Up @@ -78,16 +78,19 @@ Some WooCommerce Blocks are not fully compatible with this plugin as they do not

== Changelog ==

= 1.1.4 =
* Improved compatibility for Tiered Pricing Table for WooCommerce

= 1.1.3 =
* Migrated filters from only using 'woocommerce_get_price_html' to 'woocommerce_get_price_html' in combination with 'wc_price'. This way, the plugin should be more compatible with other plugins.
* Added compatibility for [Discount Rules for WooCommerce](https://wordpress.org/plugins/woo-discount-rules/)
* Added compatibility for Tiered Pricing Table for WooCommerce on catalog pages

= 1.1.2 =
* Added Measurement Price Calculator for WooCommerce.
* Added compatibility for Measurement Price Calculator for WooCommerce.

= 1.1.1 =
* Added Compatibility for Tiered Pricing Table for WooCommerce Premium (single product page).
* Added compatibility for Tiered Pricing Table for WooCommerce Premium (single product page).

= 1.1.0 =
* Added compatibility for [Tiered Pricing Table for WooCommerce](https://wordpress.org/plugins/tier-pricing-table/) (single product page).
Expand Down
2 changes: 1 addition & 1 deletion block/src/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "wdevs/tax-switch",
"version": "1.1.3",
"version": "1.1.4",
"title": "Tax Switch for WooCommerce",
"category": "woocommerce",
"icon": "money-alt",
Expand Down
14 changes: 8 additions & 6 deletions block/src/compatibility/TieredPriceTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ class TieredPriceTable {
data.__instance.formatting.formatPrice( data.price_excl_tax ),
true
);
summaryTable
.find( '[data-tier-pricing-table-summary-product-price]' )
.html( productPriceHtml );

// Update total price
const totalHtml = this.getWtsHtml(
Expand All @@ -164,9 +161,14 @@ class TieredPriceTable {
),
true
);
summaryTable
.find( '[data-tier-pricing-table-summary-total]' )
.html( totalHtml );
setTimeout( function () {
summaryTable
.find( '[data-tier-pricing-table-summary-product-price]' )
.html( productPriceHtml );
summaryTable
.find( '[data-tier-pricing-table-summary-total]' )
.html( totalHtml );
}, 10 );
}

getSummaryTable( productId ) {
Expand Down
8 changes: 5 additions & 3 deletions includes/class-wdevs-tax-switch.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ private function define_compatibility_hooks() {
//wc product table compatibility
$this->loader->add_filter( 'wcpt_element', $plugin_compatibility, 'activate_wc_product_table_compatibility', 10, 1 );

//TODO: move check to somewhere else?
if ( is_plugin_active( 'woocommerce-measurement-price-calculator/woocommerce-measurement-price-calculator.php' ) ) {
$this->loader->add_filter( 'woocommerce_available_variation', $plugin_compatibility, 'add_prices_to_variation', 10, 3 );
if(function_exists('is_plugin_active')){
//TODO: move check to somewhere else?
if ( is_plugin_active( 'woocommerce-measurement-price-calculator/woocommerce-measurement-price-calculator.php' ) ) {
$this->loader->add_filter( 'woocommerce_available_variation', $plugin_compatibility, 'add_prices_to_variation', 10, 3 );
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wdevs-tax-switch",
"version": "1.1.3",
"version": "1.1.4",
"description": "Let customers toggle between inclusive and exclusive VAT pricing in your WooCommerce store.",
"author": "Wijnberg Developments",
"license": "GPL-2.0-or-later",
Expand Down
4 changes: 3 additions & 1 deletion public/class-wdevs-tax-switch-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private function combine_price_displays( $current_price_text, $alternate_price_t
}

return sprintf(
'<span class="wts-price-wrapper"><span class="%s wts-active" >%s</span><span class="%s wts-inactive">%s</span></span>',
'<span class="wts-price-wrapper"><span class="%s wts-active">%s</span><span class="%s wts-inactive">%s</span></span>',
$classes[0],
$current_price_text,
$classes[1],
Expand Down Expand Up @@ -224,6 +224,8 @@ private function calculate_alternate_price( $price, $shop_display_is_incl ) {
remove_filter( 'woocommerce_prices_include_tax', [ $this, $woocommerce_prices_include_tax_filter ], 99 );
}

unset($calculator);

return $price;
}

Expand Down
4 changes: 2 additions & 2 deletions wdevs-tax-switch.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin Name: Tax Switch for WooCommerce
* Plugin URI: https://wijnberg.dev
* Description: Let customers toggle between inclusive and exclusive VAT pricing in your WooCommerce store.
* Version: 1.1.3
* Version: 1.1.4
* Author: Wijnberg Developments
* Author URI: https://wijnberg.dev/
* License: GPL-2.0+
Expand All @@ -41,7 +41,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'WDEVS_TAX_SWITCH_VERSION', '1.1.3' );
define( 'WDEVS_TAX_SWITCH_VERSION', '1.1.4' );

/**
* The code that runs during plugin activation.
Expand Down

0 comments on commit f263a0a

Please sign in to comment.