woocommerce_apply_base_tax_for_local_pickup

woocommerce_apply_base_tax_for_local_pickup

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_apply_base_tax_for_local_pickup') is found 3 times:

  • /includes/abstracts/abstract-wc-order.php line 1749
    1745
    1746
    1747
    1748
    1749
    1750
    1751
    1752
    1753
    1754
    1755
    *
     * @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 189
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    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 = 'base';
        }
     
        if ( 'base' === $tax_based_on ) {
            $country  = WC()->countries->get_base_country();
            $state    = WC()->countries->get_base_state();
  • /src/Blocks/Shipping/ShippingController.php line 379
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    $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'],