Accessing Webflow Order details from Custom Code

Hello Happy people,

We’re trying to insert some custom code that would enable us to integrate the site with a a third party affiliate application.

The application requires us to be able to send them an order ID and the order amount from the thank you page.
We’ve added the code below

<script type="text/javascript">
        (function (t, a, p) {
            t.TapfiliateObject = a; t[a] = t[a] || function () {
                (t[a].q = t[a].q || []).push(arguments)
        })(window, 'tap');
        var order_id =\S{3}-\S{3}/)[0];
        var total = Number(document.getElementsByClassName("w-commerce-commercecheckoutsummarytotal")[0].innerText.replace("£", '').trim())
        console.log("Detected Order ID " + order_id + " also detected total Amounts of " + total);
        tap('create', '176sdfsd70-sdfsdf', { integration: "stripe" });
        tap('conversion', order_id, total, { customer_id: order_id });


But when it comes to the Log information being printed it’s always 0 and doesn’t really submit the data with the information we need.

My Question is: How would we be able to access the order ID and total amount from the custom code section of the order confirmation / thank you page. Or any other CMS/DB variable in that case.

1 Like