Skip to content

Commit

Permalink
Make 100 max discount percentage
Browse files Browse the repository at this point in the history
Safeguard against percentages higher than 100, since it throws the reporting out - does not appear to affect payments (i.e. a refund for negative balance).

Fixed #1372.

See: https://wordpress.slack.com/archives/C08M59V3P/p1727101178232939
  • Loading branch information
pkevan authored Sep 24, 2024
1 parent db96562 commit a6af542
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions public_html/wp-content/plugins/camptix/camptix.php
Original file line number Diff line number Diff line change
Expand Up @@ -5118,6 +5118,10 @@ function save_coupon_post( $post_id ) {
update_post_meta( $post_id, 'tix_discount_price', $price );
delete_post_meta( $post_id, 'tix_discount_percent' );
} elseif ( $percent > 0 ) {
// Safeguard against percentages bigger than it is possible to discount against.
if ( $percent > 100 ) {
$percent = 100;
}
update_post_meta( $post_id, 'tix_discount_percent', $percent );
delete_post_meta( $post_id, 'tix_discount_price' );
} else {
Expand Down

0 comments on commit a6af542

Please sign in to comment.