Created
December 3, 2021 05:23
-
-
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
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
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