Untitled
unknown
plain_text
a year ago
881 B
2
Indexable
Never
func didSelectOption(_ option: ConfigurableVariantAttribute) { guard let product = product else { return } let selectedB2bOptionValue = product.configurableProduct?.selectedProduct?.selectedB2bOptionValue if let variant = product.configurableProduct?.variants.first(where: { $0.attributes == [option] }) { product.configurableProduct?.selectedVariant = variant product.configurableProduct?.selectedProduct?.selectedB2bOptionValue = selectedB2bOptionValue if let value = selectedB2bOptionValue, let optionId = product.configurableProduct?.selectedProduct?.configurableB2bOptions?.first( where: { $0.values.contains(value) })?.optionId { selectOption(in: product, optionId: optionId, suboptionId: value.optionTypeId) } } self.product = product updateViewForNewProductConfigurations(product) }