Created
February 22, 2023 10:27
-
-
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/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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