Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created December 3, 2021 05:23
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 xlplugins/aa734172bd18ba9eb9cf91cdfc2b4e34 to your computer and use it in GitHub Desktop.
Save xlplugins/aa734172bd18ba9eb9cf91cdfc2b4e34 to your computer and use it in GitHub Desktop.
pass order total and order ID and Order Data in script on Thank you page
add_action( 'woocommerce_thankyou', function ( $order_id ) {
$order = wc_get_order( $order_id );
if ( $order instanceof WC_Order ) {
?>
<script src="https://app.bentonow.com/c5f06303f8a5af309e3d3084f4dd7882.js"></script>
<script>
if (typeof(bento$) != 'undefined') {
bento$(function() {
bento.identify(<?php echo $order->get_billing_email(); ?>);
bento.updateFields({"first_name": <?php echo $order->get_billing_first_name(); ?>, "last_name": <?php echo $order->get_billing_last_name(); ?>});
bento.view();
});
}
</script>
<?php
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment