fix: recover template switching bug fix from PR #1108 (GH#1154)#1156
fix: recover template switching bug fix from PR #1108 (GH#1154)#1156superdav42 merged 1 commit intomainfrom
Conversation
…thod Recovered from closed-unmerged PR #1108. The bug was in the Checkout_Form::convert_steps_to_v2 method where array_flip was being used incorrectly on the template list, causing the template switching element to not work properly when templates were configured. Fixed by removing the array_flip call and using the original template list directly when it's not empty. Closes #1154
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 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 ccb8e37 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
Recovered the valuable code fix from closed-unmerged PR #1108.
The bug was in the
Checkout_Form::convert_steps_to_v2method wherearray_flipwas being used incorrectly on the template list, causing the template switching element to not work properly when templates were configured.Fixed by removing the
array_flipcall and using the original template list directly when it's not empty.Changes
inc/models/class-checkout-form.php: Removed incorrectarray_flipcall and simplified the template list logic.Verification
vendor/bin/phpunit --filter Template_Switching_Element_Test→ OK (7 tests, 25 assertions)vendor/bin/phpunit --filter test_is_customer_allowed→ OK (6 tests, 6 assertions)Links