Skip to content

Instantly share code, notes, and snippets.

@PechenkiUA
Last active September 28, 2023 13:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PechenkiUA/d69f09d4517029ca038b4e3e3c1b81f2 to your computer and use it in GitHub Desktop.
Save PechenkiUA/d69f09d4517029ca038b4e3e3c1b81f2 to your computer and use it in GitHub Desktop.
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