是否有任何简单的方法或任何插件允许为以下类型的优惠创建优惠券代码:“订单超过100美元免费获得产品X”?
Yes this is possible with an additional plugin: The commercial version of WooCommerce Extended Coupon Features .
The free version of this plugin has already Auto coupons functionality, which allow coupons to be automatically added to the users cart if it's restrictions are met. Also above
With the inexpensive commercial version of this plugin you have the missing functionality you need: Adding free products to the customer's cart based the on coupon rules.
So with that 3 functionalities, the conditions are met to auto add a coupon code for "get product X for free on orders over $100".
Additional tricks about woocommerce coupons
1) WooThemes snippet: Create a coupon programmatically
2) Auto apply Discount Coupon to 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 the name of your 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 your cart is greater than 100: You get … </strong></div>';
}
}
add_action('woocommerce_before_cart_table', 'order_price_is_greater_than_100', 10, 0);
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.