Product Icon

Smart Coupons for WooCommerce

Advanced discount rules, gift cards, BOGO deals, store credits, dynamic pricing, bulk coupon codes, URL coupons and more with this all-in-one Smart Coupons for WooCommerce plugin.

Smart Coupons – Apply to Fees at Checkout

A service fee is added to the checkout of certain products. Currently, when a user checks out, even if the gift card exceeds the order total, he or she still has to pay for the fee with one of the payment gateways. Fees can added like so:
$woocommerce->cart->add_fee( ‘Service Fee’, $service_fee, true, ‘standard’ );

Fix: Before (Line 2176 of ./woocommerce_smart_coupons.php):
$order_total = Smart_Coupons_WC_Compatibility::global_wc()->cart->cart_contents_total + Smart_Coupons_WC_Compatibility::global_wc()->cart->tax_total + Smart_Coupons_WC_Compatibility::global_wc()->cart->shipping_tax_total + Smart_Coupons_WC_Compatibility::global_wc()->cart->shipping_total;

After:
$fees_total = 0;
foreach ( Smart_Coupons_WC_Compatibility::global_wc()->cart->fees as $fee ) {
$fees_total += $fee->amount;
}

$order_total = Smart_Coupons_WC_Compatibility::global_wc()->cart->cart_contents_total + Smart_Coupons_WC_Compatibility::global_wc()->cart->tax_total + Smart_Coupons_WC_Compatibility::global_wc()->cart->shipping_tax_total + Smart_Coupons_WC_Compatibility::global_wc()->cart->shipping_total + $fees_total;

Author

Current Status

Open

Last updated: March 24, 2014

0 comments

Log in to comment on this feature request.