Skip to content

Instantly share code, notes, and snippets.

@bporcelli
Created June 23, 2023 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bporcelli/1ac1fbc71e4738283b395742045fdcba to your computer and use it in GitHub Desktop.
Save bporcelli/1ac1fbc71e4738283b395742045fdcba to your computer and use it in GitHub Desktop.
[Simple Sales Tax] Move tax exempt form after billing details
<?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