-
Notifications
You must be signed in to change notification settings - Fork 55
Add coupon generator and option to orders to add a coupon to each order #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@louwie17 Thanks for the PR. Could you add a change log entry to your PR description? There is also a merge conflict that needs to be addressed. |
3ca95ab to
89052c1
Compare
rrennick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@louwie17 This tested great for me. I only had the two minor issues that need to be looked at. Once those are fixed I'll be able to merge this.
includes/Generator/Order.php
Outdated
|
|
||
| $order->set_date_created( $date ); | ||
|
|
||
| $include_coupon = ! empty( $assoc_args['status'] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be $assoc_args['coupons']?
includes/Generator/Coupon.php
Outdated
| * @return \WC_Customer Customer object with data populated. | ||
| */ | ||
| public static function generate( $save = true, $min = 5, $max = 100 ) { | ||
| self::init_faker(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t doesn't look like the faker is used in this function.
rrennick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@louwie17 Thanks for the help.
Fixes #68
Description
Added a Coupon generator with a min and max option for the
int_randomfunction.I also added a
couponoption to the order generator CLI command, which if set, it will auto generate a coupon for each order.Testing instructions
wp wc generate coupons 10 --min=10 --max=40wp wc generate orders 10 --status=completed --coupons=truewp action-scheduler runChangelog entry