diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 74a1c229a69..26a4040d6f6 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -6,6 +6,7 @@ - [*] Increased decimal sensitivity in order creation to mitigate tax rounding issues [https://github.com/woocommerce/woocommerce-ios/pull/15957] - [*] Fix initialization of authenticator to avoid crashes during login [https://github.com/woocommerce/woocommerce-ios/pull/15953] - [*] Shipping Labels: Made HS tariff number field required in customs form for EU destinations [https://github.com/woocommerce/woocommerce-ios/pull/15946] +- [*] Order Creation: Prevent subscription products to be added to an order [https://github.com/woocommerce/woocommerce-ios/pull/15960] - [internal] Replace COTS_DEVICE reader model name with TAP_TO_PAY_DEVICE. [https://github.com/woocommerce/woocommerce-ios/pull/15961] 22.9 diff --git a/WooCommerce/Classes/ViewRelated/Products/ProductSelector/ProductSelectorView.swift b/WooCommerce/Classes/ViewRelated/Products/ProductSelector/ProductSelectorView.swift index 5a20953142a..b55681baa87 100644 --- a/WooCommerce/Classes/ViewRelated/Products/ProductSelector/ProductSelectorView.swift +++ b/WooCommerce/Classes/ViewRelated/Products/ProductSelector/ProductSelectorView.swift @@ -216,16 +216,21 @@ struct ProductSelectorView: View { ProductRow(multipleSelectionsEnabled: true, viewModel: rowViewModel, onCheckboxSelected: { - viewModel.variationCheckboxTapped(for: rowViewModel.productOrVariationID) + if rowViewModel.selectionEnabled { + viewModel.variationCheckboxTapped(for: rowViewModel.productOrVariationID) + } }) .frame(maxWidth: .infinity, alignment: .leading) .onTapGesture { - viewModel.variationRowTapped(for: rowViewModel.productOrVariationID) + if rowViewModel.selectionEnabled { + viewModel.variationRowTapped(for: rowViewModel.productOrVariationID) + } } .redacted(reason: viewModel.showPlaceholders ? .placeholder : []) .disabled(viewModel.selectionDisabled) DisclosureIndicator() + .renderedIf(rowViewModel.selectionEnabled) } .accessibilityHint(configuration.variableProductRowAccessibilityHint) } else { diff --git a/WooCommerce/Classes/ViewRelated/Products/ProductSelector/ProductSelectorViewModel.swift b/WooCommerce/Classes/ViewRelated/Products/ProductSelector/ProductSelectorViewModel.swift index 3d90c1e6562..7188790b2d8 100644 --- a/WooCommerce/Classes/ViewRelated/Products/ProductSelector/ProductSelectorViewModel.swift +++ b/WooCommerce/Classes/ViewRelated/Products/ProductSelector/ProductSelectorViewModel.swift @@ -848,6 +848,8 @@ private extension ProductSelectorViewModel { switch (source, product.productType, product.variations) { case (.orderForm, .booking, _): return .unsupported(reason: Localization.bookableProductUnsupportedReason) + case (.orderForm, .subscription, _), (.orderForm, .variableSubscription, _): + return .unsupported(reason: Localization.subscriptionProductUnsupportedReason) case (_, _, let variations) where variations.isEmpty: return selectedItemsIDs.contains(product.productID) ? .selected : .notSelected default: @@ -981,6 +983,11 @@ private extension ProductSelectorViewModel { value: "Bookable products are not supported for order creation", comment: "Message explaining unsupported bookable products for order creation" ) + static let subscriptionProductUnsupportedReason = NSLocalizedString( + "productSelectorViewModel.subscriptionProductUnsupportedReason", + value: "Subscription products are not supported for order creation", + comment: "Message explaining unsupported subscription products for order creation" + ) } }