if (variantProductExists) {
// Since the variant product is already a variant, first of all we remove the old features
// and the associations of type PRODUCT_VARIANT: a given product can be a variant of only one product.
delegator.removeByAnd("ProductAssoc", UtilMisc.toMap("productIdTo", variantProductId,
"productAssocTypeId", "PRODUCT_VARIANT"));
delegator.removeByAnd("ProductFeatureAppl", UtilMisc.toMap("productId", variantProductId,
"productFeatureApplTypeId", "STANDARD_FEATURE"));
}
// add an association from productId to variantProductId of the PRODUCT_VARIANT
Map<String, Object> productAssocMap = UtilMisc.toMap("productId", productId, "productIdTo", variantProductId,
"productAssocTypeId", "PRODUCT_VARIANT",