如何从优惠券中获得一些折扣的产品总数?请注意,优惠券可能会有一些限制,例如包含或排除某些产品/类别,最低订购价格,最高限额等...
这是我的通用代码:
$order_id = 10;
$order = new WC_Order($order_id);
foreach ($order->get_coupon_codes() as $coupon_code) {
$coupon = new WC_Coupon($coupon_code);
$coupon_amount = $coupon->get_amount();
switch ($coupon->get_discount_type()) {
case 'fixed_product':
$coupon_used = ???
break;
}
}
如何正确设置$coupon_used
变量?
谢谢