Skip to content

Instantly share code, notes, and snippets.

@PechenkiUA
Last active June 15, 2021 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PechenkiUA/9144afdf8d5971dd70464f0b3538d0d3 to your computer and use it in GitHub Desktop.
Save PechenkiUA/9144afdf8d5971dd70464f0b3538d0d3 to your computer and use it in GitHub Desktop.
telsender coupons | woocommerce
<?php
/**
* Telsender coupons name
* @param $list
* @param $order_id
* @return mixed
*/
function telsender_coupons($list, $order_id){
// (optional if not defined) An instance of the WC_Order object
$order = wc_get_order( $order_id );
$coupons = $order->get_coupon_codes();
$coupon_line = implode(' | ', $coupons);
$list['{coupons}'] = $coupon_line;
return $list;
}
add_filter( 'tscf_filter_codetemplate','telsender_coupons', 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment