Created
June 23, 2023 03:09
-
-
Save bporcelli/1ac1fbc71e4738283b395742045fdcba to your computer and use it in GitHub Desktop.
[Simple Sales Tax] Move tax exempt form after billing details
This file contains 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
<?php | |
/** | |
* Moves the SST Tax Exempt form to after the customer billing details. | |
* Place in your child theme's functions.php file or in a plugin. | |
*/ | |
function sst_move_tax_exempt_form() { | |
global $wp_filter; | |
if ( ! isset( $wp_filter['woocommerce_checkout_after_customer_details'] ) ) { | |
return; | |
} | |
$filters = $wp_filter['woocommerce_checkout_after_customer_details']; | |
foreach ( $filters as $priority => $callbacks ) { | |
foreach ( $callbacks as $callback ) { | |
if ( ! is_array( $callback['function'] ) ) { | |
continue; | |
} | |
list( $instance, $method ) = $callback['function']; | |
if ( | |
get_class( $instance ) === 'SST_Checkout' && | |
$method === 'output_exemption_form' | |
) { | |
remove_action( | |
'woocommerce_checkout_after_customer_details', | |
$callback['function'], | |
$priority | |
); | |
add_action( | |
'woocommerce_after_checkout_billing_form', | |
$callback['function'] | |
); | |
break; | |
} | |
} | |
} | |
} | |
add_action( 'init', 'sst_move_tax_exempt_form' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment