Display strikeout price with tax text, compatible for WooCommerce Tax By James Hunt

Display strike-through prices with tax text (compatibility for WooCommerce Tax By James Hunt).

add_action('wp_loaded', function() {
    if(class_exists('\Wdr\App\Router')) {
		if (has_filter('woocommerce_get_price_html', 'wpa83367_price_html', 100)) {
			remove_filter('woocommerce_get_price_html', 'wpa83367_price_html', 100);
			
			add_filter('woocommerce_get_price_html', function( $price, $product ) {
				if ( wc_get_price_including_tax( $product ) ) {
		
					global $woocommerce, $wootax_text, $wootax_incl_message, $wootax_excl_message, $wc_from;
					$dp = wc_get_price_decimals();
					$currency_symbol = null;
					$return = null;
					$tax_status = $product->is_taxable();
					$tax_value = wc_price( wc_get_price_including_tax( $product ) * 1 );
					// $currency_symbol = get_woocommerce_currency_symbol(); // phpcsignore.
					$value_stripped = number_format( (float) wc_get_price_including_tax( $product ) * 1, $dp, '.', '' );
					$value_stripped_ex = number_format( (float) wc_get_price_excluding_tax( $product ) * 1, $dp, '.', '' );
					$regular_price = $product->get_regular_price();
					$qty = 1;
		
					$price_args = array(
						'qty'   => $qty,
						'price' => $regular_price,
					);
		
					$value_stripped_sale = wc_price( number_format( (float) wc_get_price_including_tax( $product, $price_args ) * 1, $dp, '.', '' ) );
					$value_stripped_sale_ex = wc_price( number_format( (float) wc_get_price_excluding_tax( $product, $price_args ) * 1, $dp, '.', '' ) );
		
					// Change prices when apply discount from Woo Discount Rules
					$discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, 0, 'all', true, false);
            		if ($discount !== false && is_array($discount) && isset($discount['initial_price']) && isset($discount['discounted_price'])) {
						$value_stripped = number_format( (float) wc_get_price_including_tax( $product, ['price' => $discount['discounted_price']] ) * 1, $dp, '.', '' );
						$value_stripped_ex = number_format( (float) wc_get_price_excluding_tax( $product, ['price' => $discount['discounted_price']] ) * 1, $dp, '.', '' );
						$value_stripped_sale = wc_price( number_format( (float) wc_get_price_including_tax( $product, ['price' => $discount['initial_price']] ) * 1, $dp, '.', '' ) );
						$value_stripped_sale_ex = wc_price( number_format( (float) wc_get_price_excluding_tax( $product, ['price' => $discount['initial_price']] ) * 1, $dp, '.', '' ) );
					}

					$wootax_text = get_option( 'wc_tax_text', 'VAT' );
					$wc_incl = __( 'incl ', 'wc-tax' );
					$wc_excl = __( 'excl', 'wc-tax' );
					$wc_zero = __( 'No Tax', 'wc-tax' );
					$wc_from = __( 'From', 'wc-tax' );
		
					if ( $wootax_text == '' ) {
						$wootax_text = __( 'VAT', 'wc-tax' );
					}
		
					$wootax_incl_message = '('.$wc_incl . ' ' . $wootax_text.')';
					$wootax_excl_message = '('.$wc_excl . ' ' . $wootax_text.')';
		
					$product_tax_class = $product->get_tax_class();
		
					// replace text for zero rated items.
					if ( $product_tax_class === 'zero-rate') {
						$wootax_incl_message = $wc_zero;
						$wootax_excl_message = $wc_zero;
					}
		
					// formats to number of decimal points set in settings.
					$value_stripped = wc_price( wc_format_decimal( $value_stripped, $dp ) );
					$value_stripped_ex = wc_price( wc_format_decimal( $value_stripped_ex, $dp ) );
		
					// Show strikeout only product is on sale or product has discount from woo discount rules plugin
					if ( $product->get_sale_price() || $discount !== false ) {
						$return = '<del><span class="amount product-tax-on product-tax" style="display:none;" title="With ' . $wootax_text . ' added"><span class="from-text">' . ( $product->has_child() ? __( 'From', 'wc-tax' ) . ' ' : '' ) . '</span>'. sprintf( get_woocommerce_price_format(), $currency_symbol, $value_stripped_sale ) . ' <span class="gst-message">' . $wootax_incl_message . '</span></span><span class="amount product-tax-off product-tax"><span class="from-text">' . ( $product->has_child() ? $wc_from . ' ' : '' ) . '</span>' . sprintf( get_woocommerce_price_format(), $currency_symbol, $value_stripped_sale_ex ) . ' <span class="gst-message">' . $wootax_excl_message . '</span></span></del>';
					}
		
					// Return for everything else.
					$return .= '<span class="amount product-tax-on product-tax" style="display:none;" title="With ' . $wootax_text . ' added"><span class="from-text">' . ( $product->has_child() ? $wc_from . ' ' : '' ) . '</span>' . sprintf( get_woocommerce_price_format(), $currency_symbol, $value_stripped ) . ' <span class="gst-message">' . $wootax_incl_message . '</span></span><span class="amount product-tax-off product-tax"><span class="from-text">' . ( $product->has_child() ? $wc_from . ' ' : '' ) . '</span>' . sprintf( get_woocommerce_price_format(), $currency_symbol, $value_stripped_ex ) . ' <span class="gst-message">' . $wootax_excl_message . '</span></span>';
					$price = $return;
		
				}
				// TODO: Reorder else statements to take in to account free items with discount?
		
				return $price;
			}, 1000000, 2);
		}
    }
}, 100);