Skip to content

Instantly share code, notes, and snippets.

@bekarice
Created September 6, 2017 21:18
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 bekarice/fd1603fcf451f4ee3bdf4369e383daed to your computer and use it in GitHub Desktop.
Save bekarice/fd1603fcf451f4ee3bdf4369e383daed to your computer and use it in GitHub Desktop.
<?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