I need to record the date of the last time each coupon was used in WooCommerce.
I have seen that the post_meta
table saves a used_by record with the emails of the clients who used it, but there is no date record.
Looking for filters I think this one can help me to also record the date:
woocommerce_increase_coupon_usage_count
Can someone guide me on how to add that record?
2
Answers
The
woocommerce_increase_coupon_usage_count
action hook can indeed be used. Then it’s just a matter of creating metadata with the desired valueSo you get:
To retrieve the data:
$coupon
objectget_post_meta()
Another solution is here. You can try this solution.