Skip to content

Instantly share code, notes, and snippets.

@juliebugmtl
Created August 9, 2021 01:22
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 juliebugmtl/5be505576977b6519aa116d0749cf91f to your computer and use it in GitHub Desktop.
Save juliebugmtl/5be505576977b6519aa116d0749cf91f to your computer and use it in GitHub Desktop.
Removes taxes from order total when sending order information to Google Analytics - for use with Google Analytics Pro
<?php // only use if needed
// Will remove taxes from the order total when transmitting to Google Analytics
function sv_wc_gapro_send_revenue_only_order ( $params ) {
$order_total = $params['tr'];
$order_tax = $params['tt'];
$revenue = $order_total - $order_tax;
$params['tr'] = $revenue;
return $params;
}
add_filter( 'wc_google_analytics_pro_api_ec_purchase_parameters', 'sv_wc_gapro_send_revenue_only_order' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment