Skip to content

Instantly share code, notes, and snippets.

@AlexandrKrot
Last active May 24, 2022
Embed
What would you like to do?
Telsender UTM Leads Tracker - XLPlugins Woocomerse
<?php
/*
* {utm_source}
* {utm_medium}
* {utm_campaign}
*/
add_filter('tscf_filter_codetemplate', function ($list, $order_id) {
$order = wc_get_order($order_id);
$utm = get_post_meta($order->get_id(), 'before_order_cookie_xlutm_params_utm', true);
if (!$utm) return $list;
$utm = array_pop($utm);
if ($utm) {
foreach ($utm as $key => $name) {
$list['{' . $key . '}'] = sprintf('%s: %s',$key,$name);
}
}
return $list;
}, 20, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment