Skip to content
Advertisement

How to insert Google Merchant Review JS code in WooCommerce Order Complete page

I want to complete the variables the Google Merchant Review codes asks to be completed on the checkout page:

JavaScript

I need to echo the following variables:

ORDER_ID: ID number of the WooCommerce order ID

CUSTOMER_EMAIL: The email listed in the customer information section of the order

DELIVERY_COUNTRY: I think I can just fill it with ES since I only sell in Spain

ESTIMATED_DELIVERY_DATE: I already have a function I use to calculate the shipping date, so I guess I can use that php function here.

In conclusion, I would need help figuring out how do I echo the ORDER_ID and CUSTOMER_EMAIL in the checkout page, concretely inside of said script. I’m kind of clueless on how to do so, since all I tried had kind of a catastrophic result

Thank you very much for reading!

TL;DR: How do I get to echo the ORDER_ID and CUSTOMER_EMAIL in the after payment checkout page on WooCommerce?

Advertisement

Answer

If you want to add a JavaScript goal conversions code to your Order complete or Thankyou page then you have to use woocommerce_thankyou hook.

Here is the code:

JavaScript

Code goes in functions.php file of your active child theme (or theme). Or also in any plugin PHP files.
Code is tested and works.

Reference:

Related Questions

Hope this helps!

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement