fix: prevent PWYW pricing type from being reset to free on save#831
fix: prevent PWYW pricing type from being reset to free on save#831superdav42 merged 1 commit intomainfrom
Conversation
Product::is_free() treated Pay What You Want products with $0 suggested/minimum amounts as free, causing Product::save() to silently override the pricing_type to 'free'. A PWYW product is by definition not free — the customer decides the price. - Add early return in is_free() for PWYW products - Narrow save() guard to only normalize 'paid' type to 'free'
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughUpdated Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for c662239 are in 🛎️! Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown. URL:
|
Summary
Reproduction
Changes
Testing
Merged via PR #831 to main. aidevops.sh v3.8.17 spent 9m on this as a headless bash routine. |
Summary
Product::is_free()returnedtruefor PWYW products with $0 amounts, triggering thesave()guard that auto-normalizes free productsis_free()now returnsfalsefor PWYW, and thesave()guard is narrowed to only normalize thepaidtypeReproduction
Changes
inc/models/class-product.phpis_free(): early returnfalsefor PWYW productssave(): guard condition narrowed from!== 'contact_us'to=== 'paid'Testing
Summary by CodeRabbit