From 1e62719dae96349e269d80d2d13bdcf2bed0c319 Mon Sep 17 00:00:00 2001 From: vendidero Date: Wed, 30 Oct 2024 12:06:52 +0100 Subject: [PATCH] Added a filter to allow marking some products as photovoltaic accessories in case a vat exemption exists. --- includes/class-wc-gzd-checkout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-gzd-checkout.php b/includes/class-wc-gzd-checkout.php index 7d013a14..15527461 100644 --- a/includes/class-wc-gzd-checkout.php +++ b/includes/class-wc-gzd-checkout.php @@ -338,7 +338,7 @@ public function maybe_adjust_photovoltaic_cart_data( $cart ) { foreach ( $cart->get_cart() as $cart_item_key => $values ) { $_product = apply_filters( 'woocommerce_cart_item_product', $values['data'], $values, $cart_item_key ); - if ( wc_gzd_get_product( $_product )->is_photovoltaic_system() ) { + if ( wc_gzd_get_product( $_product )->is_photovoltaic_system() || apply_filters( 'woocommerce_gzd_photovoltaic_cart_product_is_photovoltaic_accessory', false, $_product ) ) { if ( wc_prices_include_tax() && 'yes' === get_option( 'woocommerce_gzd_photovoltaic_systems_net_price' ) ) { $price = $_product->get_price(); $excluding_tax = wc_get_price_excluding_tax( @@ -358,7 +358,7 @@ public function maybe_adjust_photovoltaic_cart_data( $cart ) { foreach ( $cart->get_cart() as $cart_item_key => $values ) { $_product = apply_filters( 'woocommerce_cart_item_product', $values['data'], $values, $cart_item_key ); - if ( wc_gzd_get_product( $_product )->is_photovoltaic_system() ) { + if ( wc_gzd_get_product( $_product )->is_photovoltaic_system() || apply_filters( 'woocommerce_gzd_photovoltaic_cart_product_is_photovoltaic_accessory', false, $_product ) ) { $zero_tax_class = get_option( 'woocommerce_gzd_photovoltaic_systems_zero_tax_class', 'zero-rate' ); /**