| @@ -789,9 +789,8 @@ | ||
| 789 | 789 | 'billing_company_name' => 'form_data.billing_company_name', |
| 790 | 790 | 'billing_legal_registration_id' => 'form_data.billing_legal_registration_id', |
| 791 | 791 | 'is_business' => 'form_data.is_business', |
| 792 | 792 | 'fct_billing_tax_id' => 'tax_data.vat_number', |
| 793 | - 'fct_vat_declaration_note' => 'tax_data.declaration_note', | |
| 794 | 793 | ]; |
| 795 | 794 | |
| 796 | 795 | $addressFieldKeys = [ |
| 797 | 796 | 'full_name', |
| @@ -1039,9 +1038,9 @@ | ||
| 1039 | 1038 | return new \WP_Error('no_cart', __('No active cart found', 'fluent-cart')); |
| 1040 | 1039 | } |
| 1041 | 1040 | |
| 1042 | 1041 | $checkoutData = $cart->checkout_data; |
| 1043 | - if (!empty($checkoutData['upgrade_data']) || !empty($checkoutData['is_locked'])) { | |
| 1042 | + if (!$cart->acceptsAdditionalItems()) { | |
| 1044 | 1043 | return new \WP_Error('invalid_request', __('This cart is locked or already has an upgrade applied.', 'fluent-cart')); |
| 1045 | 1044 | } |
| 1046 | 1045 | |
| 1047 | 1046 | $upgradeFromVariationId = (int) Arr::get($requestData, 'upgrade_form', 0); |
| @@ -1056,8 +1055,14 @@ | ||
| 1056 | 1055 | 'request_data' => $requestData |
| 1057 | 1056 | ]); |
| 1058 | 1057 | } |
| 1059 | 1058 | |
| 1059 | + // A locked cart may still take bumps through the accepts_additional_items | |
| 1060 | + // filter, but must never let an item it pinned be swapped out. | |
| 1061 | + if (Arr::get($checkoutData, 'is_locked') === 'yes') { | |
| 1062 | + return new \WP_Error('invalid_request', __('This cart is locked and cannot be modified.', 'fluent-cart')); | |
| 1063 | + } | |
| 1064 | + | |
| 1060 | 1065 | if (!$upgradeFromVariationId || !$targetVariationId) { |
| 1061 | 1066 | return new \WP_Error('invalid_request', __('Invalid upgrade request.', 'fluent-cart')); |
| 1062 | 1067 | } |
| 1063 | 1068 | |
| @@ -1140,10 +1145,8 @@ | ||
| 1140 | 1145 | } else if (in_array($dataKey, ['billing_company_name', 'shipping_company_name', 'billing_legal_registration_id'])) { |
| 1141 | 1146 | $sanitizedData[$dataKey] = sanitize_text_field($dataValue); |
| 1142 | 1147 | } else if ($dataKey === 'is_business') { |
| 1143 | 1148 | $sanitizedData[$dataKey] = $dataValue === 'yes' ? 'yes' : 'no'; |
| 1144 | - } else if ($dataKey === 'fct_vat_declaration_note') { | |
| 1145 | - $sanitizedData[$dataKey] = mb_substr(sanitize_text_field($dataValue), 0, 255); | |
| 1146 | 1149 | } else if ($dataKey === 'billing_state' && !empty($dataValue)) { |
| 1147 | 1150 | $billingCountry = Arr::get($allData, 'billing_country'); |
| 1148 | 1151 | |
| 1149 | 1152 | $states = LocalizationManager::getInstance()->statesOptions($billingCountry); |