Reputation: 21
Woocommerce pulgin - Hi, I am looking for a wordpress plugin for my website http://fashions.aad-on.com , to apply Discount on total cart "if the total cart amount exceeds a particular amount". Example: 10% Discount on total cart if the total cart equals or exceeds $ 500/-
Upvotes: 0
Views: 5503
Reputation: 4351
You don't need extra plugin for that. It is included in WooCommerce core.
Create a coupon -> Give it a code -> Select discount type as Cart % discount
-> Set Coupon amount
as 10 -> Set Minimum amount
as 500 -> Save the coupon. You're done!
To apply coupon code automatically, try following code:
add_action( 'woocommerce_before_cart', 'apply_matched_coupons' );
function apply_matched_coupons() {
global $woocommerce;
$coupon_code = '10percent'; // your coupon code here
if ( $woocommerce->cart->has_discount( $coupon_code ) ) return;
if ( $woocommerce->cart->cart_contents_total >= 500 ) {
$woocommerce->cart->add_discount( $coupon_code );
$woocommerce->show_messages();
}
}
Upvotes: 4