Skip to content

Instantly share code, notes, and snippets.

@boluda
Last active April 19, 2018 10:21
Show Gist options
  • Save boluda/da8a781e84053be50ac6 to your computer and use it in GitHub Desktop.
Save boluda/da8a781e84053be50ac6 to your computer and use it in GitHub Desktop.
// Añadir valor en píxel conversión Facebook con WooCommerce
add_action( 'woocommerce_thankyou', 'jb_pixeltracking' );
function jb_pixeltracking( $order_id ) {
$order = new WC_Order( $order_id );
$order_total = $order->get_total();
?>
  <!-- Nuevo pixel de Facebook, acción conversión dinámica -->
<script>
fbq('track', 'Purchase', {value: '<?php echo $order_total ?>', currency: 'EUR'});
</script>
<!-- END FB Tracking -->
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment