woocommerce_apply_base_tax_for_local_pickup, true

woocommerce_apply_base_tax_for_local_pickup, true

Appears in:
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.11.0.0

apply_filters('woocommerce_apply_base_tax_for_local_pickup, true') is found 4 times:

  • /includes/abstracts/abstract-wc-order.php line 1918
    		 *
    		 * @since 6.8.0
    		 * @param boolean apply_base_tax Whether apply base tax for local pickup. Default true.
    		 */
    		$apply_base_tax = true === apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true );
    
    		/**
    		 * Filters local pickup shipping methods.
    		 *
    		 * @since 6.8.0
    		 * @param string[] $local_pickup_methods Local pickup shipping method IDs.
    
  • /includes/class-wc-customer.php line 191
    	public function get_taxable_address() {
    		$tax_based_on = get_option( 'woocommerce_tax_based_on' );
    
    		// Check shipping method at this point to see if we need special handling.
    		if ( true === apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true ) && count( array_intersect( wc_get_chosen_shipping_method_ids(), apply_filters( 'woocommerce_local_pickup_methods', array( 'legacy_local_pickup', 'local_pickup' ) ) ) ) > 0 ) {
    			$tax_based_on = TaxBasedOn::BASE;
    		}
    
    		if ( TaxBasedOn::BASE === $tax_based_on ) {
    			$country  = WC()->countries->get_base_country();
    			$state    = WC()->countries->get_base_state();
    
  • /src/Blocks/Shipping/ShippingController.php line 452
    		$chosen_method_id       = explode( ':', $chosen_method )[0];
    		$chosen_method_instance = explode( ':', $chosen_method )[1] ?? 0;
    
    		// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
    		if ( $chosen_method_id && true === apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true ) && in_array( $chosen_method_id, LocalPickupUtils::get_local_pickup_method_ids(), true ) ) {
    			$pickup_locations = get_option( 'pickup_location_pickup_locations', array() );
    			$pickup_location  = $pickup_locations[ $chosen_method_instance ] ?? array();
    
    			if ( isset( $pickup_location['address'], $pickup_location['address']['country'] ) && ! empty( $pickup_location['address']['country'] ) ) {
    				$address = array(
    					$pickup_locations[ $chosen_method_instance ]['address']['country'],
    
  • /src/Blocks/Shipping/ShippingController.php line 494
    			return $location;
    		}
    
    		// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
    		if ( true !== apply_filters( 'woocommerce_apply_base_tax_for_local_pickup', true ) ) {
    			return $location;
    		}
    
    		// Use the same canonical local pickup method list that WC_Abstract_Order::get_tax_location() uses to force
    		// the base address. Relying on the currently-registered methods (LocalPickupUtils::get_local_pickup_method_ids())
    		// would miss legacy or deregistered methods on existing orders, leaving them taxed at the store base instead.