-
-
Save bekarice/fd1603fcf451f4ee3bdf4369e383daed to your computer and use it in GitHub Desktop.
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 // only copy if needed! | |
/** | |
* Stops WooCommerce AvaTax from sending orders to Avalara after calculation. | |
* | |
* Will still calculate tax at checkout, but refunds cannot be processed via WooCommerce with accurate tax reporting. | |
*/ | |
function sv_wc_avatax_block_sending_orders() { | |
if ( function_exists( 'wc_avatax' ) ) { | |
$actions_to_remove = array( | |
'woocommerce_payment_complete', | |
'woocommerce_order_status_on-hold_to_processing', | |
'woocommerce_order_status_on-hold_to_completed', | |
'woocommerce_order_status_failed_to_processing', | |
'woocommerce_order_status_failed_to_completed', | |
); | |
foreach ( $actions_to_remove as $action ) { | |
remove_action( $action, array( wc_avatax()->get_order_handler(), 'process_paid_order' ) ); | |
} | |
} | |
} | |
add_action( 'init', 'sv_wc_avatax_block_sending_orders' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment