Created
March 5, 2026 13:18
-
-
Save xlplugins/8d8bb48c4cc47dbaa7c553886510c27a to your computer and use it in GitHub Desktop.
Tax Switch for WooCommerce cart compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Plugin Name: FKCart Tax Switch Suppress | |
| * Description: Hides Tax Switch dual price (incl/excl VAT) only in the cart icon/menu. | |
| * Keeps it active in the cart modal, product pages, etc. | |
| * Uses FKCart's native hooks - no backtrace. | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; | |
| } | |
| add_filter( 'wdevs_tax_switch_skip_next_price_wrap', function( $skip, $context, $public ) { | |
| // Cart icon = menu OR fragment build before modal loads | |
| // Cart modal = fkcart_after_header fires (side-cart.php) | |
| $in_menu = function_exists( 'doing_filter' ) && doing_filter( 'wp_nav_menu_items' ); | |
| $in_fragments = function_exists( 'doing_filter' ) && doing_filter( 'woocommerce_add_to_cart_fragments' ); | |
| $modal_loaded = function_exists( 'did_action' ) && did_action( 'fkcart_after_header' ); | |
| // Suppress only when: menu (cart icon) OR fragments before modal (cart icon parts) | |
| if ( $in_menu || ( $in_fragments && ! $modal_loaded ) ) { | |
| return true; | |
| } | |
| return $skip; | |
| }, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment