Skip to content

fix(print): guard division-by-zero & correct wcorder args#3

Open
isaeedam-ir wants to merge 1 commit intopeprodev:masterfrom
isaeedam-ir:patch-1
Open

fix(print): guard division-by-zero & correct wcorder args#3
isaeedam-ir wants to merge 1 commit intopeprodev:masterfrom
isaeedam-ir:patch-1

Conversation

@isaeedam-ir
Copy link

  • Fixes fatal DivisionByZeroError when $realprice is 0 (email invoice PDF generation).
  • Adds guard for $wasPrice <= 0, clamps result to 0..100.
  • Corrects wcorder call to calc_precentage(new=total, was=subtotal).
  • Repro: mark multiple orders “processing” with subtotal=0 (or total=0), plugin attaches PDF → fatal.
  • Env: WP 6.8.3, WooCommerce (version), PHP 8.4.x.

…rder args

Fixes fatal DivisionByZeroError when $realprice is 0 (email invoice PDF generation).
Adds guard for $wasPrice <= 0, clamps result to 0..100.
Corrects wcorder call to calc_precentage(new=total, was=subtotal).
Repro: mark multiple orders “processing” with subtotal=0 (or total=0), plugin attaches PDF → fatal.
Env: WP 6.8.3, WooCommerce (version), PHP 8.4.x.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant