Hi - I am trying to integrate with an affiliate program and need to pass order info to them from my order confirmation page.
It doesn't seem there is a standard Order Info array that I can use to set up variables in Google Tag Manager, am I missing something?
I could use the Order Info array created by the Google Analytics add-on, but that array is missing Coupon Code and Discount details which I need to pass.
2 questions I guess
1. Can I add Coupon & Discount details to the array already created by Google Analytics add on? If so any idea how? This seems would be the ideal / quickest solution
2. Is there a better plugin/add-on that I can use to pass full order details from confirmation page
Thanks
Hello.
1) You can use $order_info array on the order details page design/themes/responsive/templates/views/orders/details.tpl
{if $order_info.coupons}'coupon': {foreach from=$order_info.coupons item="promo" key="coupon"}'{$coupon|escape:"javascript"}'{/foreach}{/if}
2) Our addon can be adapted to send this data to google analytics
Hello.
1) You can use $order_info array on the order details page design/themes/responsive/templates/views/orders/details.tpl
{if $order_info.coupons}'coupon': {foreach from=$order_info.coupons item="promo" key="coupon"}'{$coupon|escape:"javascript"}'{/foreach}{/if}
2) Our addon can be adapted to send this data to google analytics
Please note that the correct template of the order confirmation page is
design/themes/responsive/templates/views/checkout/complete.tpl
There is also the checkout:order_confirmation hook in this template which can be used for sending data to 3rd party services
Please note that the correct template of the order confirmation page is
design/themes/responsive/templates/views/checkout/complete.tpl
There is also the checkout:order_confirmation hook in this template which can be used for sending data to 3rd party services
Thanks, i think that's the exact hook I need.
Unfortunately I have 0 coding knowledge of how to put the below in there... Can you help at all?
- Unique Order ID
- Product SKUs purchased
- Quantity of each product purchased
- Price of each product purchased
- Currency of the transaction
- Discount Amount (whole-order and item-specific)
- Coupon Code used
As i say the Google Analytics add on actually covers most of these (except discouont and coupon), but that is a workaround.
You should use the 'checkout:order_complete' hook.
You would use variables like
{$order_info.order_id} {* the order_id *}
{$order_info.currency} {* Currency of the transaction *}
{$order_info.discount} {* Amount of the discount *}
{* Don't remember how to get the coupon code(s) but they are also available in the $order_info *}
then you would loop through the products and get the product specific info used:
{foreach from=$order_info.product key="cid" item="item"}
{$item.product_code} {* your SKU *}
{$item.amount} {* quantity *}
{$item.price} {* price *}
{/foreach}
To check the whole tree of the $order_info array, you can temporary use the following code
{$order_info|fn_print_r}
Thanks so much for this, I am going to try to get this working right now! Thanks again :)