Home Passing Variable Values of WooCommerce using Pixel Code
Reply: 1

Passing Variable Values of WooCommerce using Pixel Code

Younes Na
Younes Na Published in 2017-06-18 19:53:18Z

I have been requested by a Marketing company to place a Pixel Code in my WooCommerece checkout page to track conversions and generate reports.

Pixel Code:

<!-- Offer Goal Conversion: Cameras -->

It's required to replace AMOUNT with the sale amount of my cart and replace SUB_ID with the unique value (Like Order Number/id).

I tried replacing both values with several variables and values Like order_id, $order_id, $subtotal, subtotal but it doesn't seem to read and pass any data to the conversion report.

I need help to identify the correct WooCommerce variables for Cart Subtotal and Order Number that will read and pass data to the conversion report.

My Website is www.Trenddr.com

Thank You.

Thomas Beumer
Thomas Beumer Reply to 2017-06-18 19:57:04Z

for subtotal:

1) With global $woocommerce; variable:

global $woocommerce;  

// or


2) Without global $woocommerce; variable:


// Or


for the order id:

global $woocommerce, $post;

$order = new WC_Order($post->ID);

//to escape # from order id 

$order_id = trim(str_replace('#', '', $order->get_order_number()));
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.331424 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO