Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created February 22, 2023 10:27
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 webtoffee-git/c5ea9e7d90c154ad625653ce26c79b53 to your computer and use it in GitHub Desktop.
Save webtoffee-git/c5ea9e7d90c154ad625653ce26c79b53 to your computer and use it in GitHub Desktop.
To remove free gift row from email and frontend order detail section - Smart Coupons For WooCommerce Coupons by WebToffee (https://wordpress.org/plugins/wt-smart-coupons-for-woocommerce/)
<?php // do not copy this line
add_filter('woocommerce_get_order_item_totals', 'wt_sc_remove_free_gift_row', 12, 3);
function wt_sc_remove_free_gift_row($total_rows, $order, $tax_display)
{
$out = array();
foreach($total_rows as $row_key => $row_value)
{
if(false === strpos($row_key, 'free_product_'))
{
$out[$row_key] = $row_value;
}
}
return $out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment