php - “Get product X for free on orders over $100” coupon code in WooCommerce -


is there simple way or plugin around allows create coupon code following kind of offer: "get product x free on orders on $100"?

yes possible additional plugin: commercial version of woocommerce extended coupon features.

  • in woocommerce coupons settings have minimum field orders amount:

minimun amount spend

so 3 functionalities, conditions met auto add coupon code "get product x free on orders on $100".


additional tricks woocommerce coupons

1) woothemes snippet: create coupon programmatically

2) auto apply discount coupon customer’s purchase:

function order_price_is_greater_than_100() {      global $woocommerce, $total_qty;      if ( $woocommerce->cart->has_discount( $coupon_code ) ) return;      if ( $woocommerce->cart->get_cart_total() >= 100 ) {          $coupon_code = 'uniquecode'; // <= set name of coupon code here          if (!$woocommerce->cart->add_discount( sanitize_text_field( $coupon_code ))) {             $woocommerce->show_messages();         }          echo '<div class="woocommerce_message"><strong>the total price in cart greater 100: … </strong></div>';      } } add_action('woocommerce_before_cart_table', 'order_price_is_greater_than_100', 10, 0); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -