Skip to content

Commit

Permalink
support the --reset-total-sales flag
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed Feb 19, 2018
1 parent 6298271 commit 4658999
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ Our Premium Plugins:

== Changelog ==

= [0.2.1] 2017-01-19 =
= [0.2.2] 2017-02-19 =
* Add support for the `--reset-deleted-sales` flag to the `reset-paypal-orders` command

= [0.2.1] 2017-02-18 =

* Add support for the `--reset-deleted-attendees` flag to the `reset-paypal-orders` command
* Add support for the `--dont-send-emails` flag to the `generate-paypal-orders` and `update-paypal-order-status` commands
Expand Down
7 changes: 7 additions & 0 deletions src/Commerce/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,17 @@ public function generate_paypal_orders( array $args = null, array $assoc_args =
* [--reset-deleted-attendees]
* : reset the number of deleted attendees
*
* [--reset-total-sales]
* : reset the total sales to 0; for tickets only
*
*
* ## EXAMPLES
*
* wp commerce reset-paypal-orders 23
* wp commerce reset-paypal-orders 23 --reset-deleted-attendees
* wp commerce reset-paypal-orders 23 --reset-total-sales
* wp commerce reset-paypal-orders 23 --reset-total-sales=3
* wp commerce reset-paypal-orders 23 --reset-total-sales=3 --reset-deleted-attendees
*
* @subcommand reset-paypal-orders
*
Expand Down
5 changes: 5 additions & 0 deletions src/Commerce/Generator/PayPal/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ public function reset_orders( array $args = array(), array $assoc_args = array()
delete_post_meta( $target_id, Tribe__Tickets__Attendance::DELETED_ATTENDEES_COUNT );
WP_CLI::log( 'Deleted attendees count reset to 0' );
}

if ( $is_ticket && isset( $assoc_args['reset-total-sales'] ) ) {
update_post_meta( $target_id, 'total_sales', 0 );
WP_CLI::log( "Total sales count reset to 0" );
}
}

/**
Expand Down

0 comments on commit 4658999

Please sign in to comment.