有没有任何简单的方法或插件,允许创建优惠券代码为以下类型的优惠:“获得产品X免费订单超过100美元”?
发布于 2016-06-01 02:46:02
是的,这是可能的,通过一个额外的插件:商业版的WooCommerce扩展优惠券特征。

因此,通过这3种功能,满足了自动添加优惠券代码的条件,即“免费获得产品X,订单超过100美元”。
关于woocommerce优惠券的附加技巧
1) WooThemes片段:以编程方式创建优惠券
2)在顾客购买时自动贴现优惠券:
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);https://stackoverflow.com/questions/37501884
复制相似问题