There is no field for the number of times the coupon was used in Add fields when creating a new view. while other related fields such as (Usage limit) are available, According to database check:
-
The fields that can be displayed in the view are all in the table: commerce_promotion_coupon. Therefore, there is no field in which to store the sum of the uses of the coupon.
-
The number of used coupons, are the sum of those in the commerce_order__coupons table with coupons_target_id filter. and in the code (in commerce/modules/promotion/src/CouponListBuilder.php) it counted by this:
$this->usageCounts = $this->usage->loadMultipleByCoupon($coupons);
i need a list of Coupons and there Usage. so my question is: How can i get Coupons Usage in view?