简体   繁体   中英

Apply Discount over shipping cost only - Woocommerce

In woocommerce I'want to apply discount coupon on shipping cost only. I'm providing only shipping service to my customer and offering some discount via coupon, So, I just want to apply that discount amount on Shipping Cost only?

WooCommerce developers do not support this kind of discount . see the attached image below:

在此输入图像描述

however, maybe following hack could work:

you need to edit wc-admin-functions.php file, you can find it inside woocommerce=>includes=>admin directory.

Search and find this:

update_post_meta( $order_id, '_cart_discount', $subtotal - $total );

and replace it with the following one:

update_post_meta( $order_id, '_cart_discount', $total_shipping_tax );

I personally, do not like this way, the better way could be override this statement from functions.php file of your active theme, or you should hook this code into a suitable WooCommerce Action .

so whenever you or your client update the plugin your change remain unaffected. let me know if you find any other solutions that work.

You can provide coupons on the basis of shipping method. In this case, the coupon will be applied only to those customers who use the linked shipping method. The coupon can also be made to apply for certain customers based on location. The free coupon extension plugin Smart coupon for WooCommerce lets you do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM