← All changes
|
Libs/freemius/includes/managers/class-fs-checkout-manager.php
+10
-1
4.2.6
→
4.3.2
View file →
| @@ -109,8 +109,17 @@ | ||
| 109 | 109 | } else { |
| 110 | 110 | // If add-on isn't activated assume the premium version isn't installed. |
| 111 | 111 | $is_premium = false; |
| 112 | 112 | } |
| 113 | + | |
| 114 | + // Override the checkout context with the add-on's purchase details so the checkout flow is initialized for the selected add-on instead of the parent product. | |
| 115 | + $context_params['plugin_id'] = $plugin_id; | |
| 116 | + | |
| 117 | + foreach ( array( 'plan_id', 'pricing_id', 'billing_cycle', 'is_trial' ) as $param ) { | |
| 118 | + if ( fs_request_has( $param ) ) { | |
| 119 | + $context_params[ $param ] = fs_request_get( $param ); | |
| 120 | + } | |
| 121 | + } | |
| 113 | 122 | } |
| 114 | 123 | |
| 115 | 124 | // Get site context secure params. |
| 116 | 125 | if ( $fs->is_registered() ) { |
| @@ -186,9 +195,9 @@ | ||
| 186 | 195 | |
| 187 | 196 | // Allowlist only allowed query params. |
| 188 | 197 | $filtered_params = array_intersect_key($filtered_params, $this->_allowed_custom_params); |
| 189 | 198 | |
| 190 | - return array_merge( $context_params, $filtered_params, $_GET, array( | |
| 199 | + return array_merge( $_GET, $context_params, $filtered_params, array( | |
| 191 | 200 | // Current plugin version. |
| 192 | 201 | 'plugin_version' => $fs->get_plugin_version(), |
| 193 | 202 | 'sdk_version' => WP_FS__SDK_VERSION, |
| 194 | 203 | 'is_premium' => $is_premium ? 'true' : 'false', |