Commit a08dd79
committed
fix(reactivation): address remaining CodeRabbit findings from PR #751 review
- renew(): capture $previous_status before set_status() so the
date_cancellation guard compares against the pre-update status.
Previously the check was always false because get_status() returned
the new 'active' value after set_status() ran.
- reactivate(): remove ': bool' return type (renew() can return
WP_Error); update PHPDoc to 'bool|\WP_Error'; change success check
from 'if ($result)' to 'if (true === $result)' so WP_Error objects
(truthy) don't trigger the post-reactivation hooks.
- build_from_membership() reactivation path: set duration/duration_unit
from the plan BEFORE calling add_product() so line items are created
with the correct billing period. Replace get_addon_ids() (discards
quantities) with get_addon_products() (product_id => quantity map) so
addon quantities are preserved when rebuilding the cart.
Closes #7521 parent dad36a4 commit a08dd79
2 files changed
+47
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
| 885 | + | |
896 | 886 | | |
897 | 887 | | |
898 | 888 | | |
899 | 889 | | |
900 | | - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
901 | 906 | | |
902 | 907 | | |
903 | 908 | | |
904 | 909 | | |
905 | 910 | | |
906 | | - | |
907 | | - | |
908 | | - | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
909 | 920 | | |
910 | | - | |
911 | | - | |
| 921 | + | |
912 | 922 | | |
913 | | - | |
914 | | - | |
915 | | - | |
| 923 | + | |
| 924 | + | |
916 | 925 | | |
917 | 926 | | |
918 | 927 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2304 | 2304 | | |
2305 | 2305 | | |
2306 | 2306 | | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
2307 | 2317 | | |
2308 | 2318 | | |
2309 | 2319 | | |
| |||
2312 | 2322 | | |
2313 | 2323 | | |
2314 | 2324 | | |
2315 | | - | |
2316 | | - | |
2317 | | - | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
2318 | 2329 | | |
2319 | 2330 | | |
2320 | 2331 | | |
2321 | | - | |
| 2332 | + | |
2322 | 2333 | | |
2323 | 2334 | | |
2324 | 2335 | | |
| |||
2363 | 2374 | | |
2364 | 2375 | | |
2365 | 2376 | | |
2366 | | - | |
| 2377 | + | |
2367 | 2378 | | |
2368 | | - | |
| 2379 | + | |
2369 | 2380 | | |
2370 | 2381 | | |
2371 | 2382 | | |
| |||
2394 | 2405 | | |
2395 | 2406 | | |
2396 | 2407 | | |
2397 | | - | |
| 2408 | + | |
2398 | 2409 | | |
2399 | 2410 | | |
2400 | 2411 | | |
| |||
0 commit comments