Is there a way to find a specific product variant by inputting the productId and the currently selected options? Here’s what happens when the customer clicks on an option:
$w ( ‘#waterpumpSelectionRepeater’ ). onItemReady (( $item , itemData , index ) => {
$item ( ‘#selectWaterPumpButton’ ). onClick (() => {
selectChoiceForOption ( $item , ‘Water Pump’ , itemData );
changePriceText ();
//on mobile, make all repeaters collapsed
**if** ( wixWindow . formFactor === 'Mobile' ) {
toggleFold ( 5 );
}
});
})
function changePriceText ( ){
product . getVariants ( productId , selectedOptions ). then (( variantItem ) => {
let varPrice = variantItem [ 0 ]. variant . formattedPrice ;
$w ( ‘#pricetext’ ). text = varPrice . toLocaleString ();
});
}
Right now, the price text will change to whichever variant matches the index variantItem[x]. How do I make it so that this product variant reference correlates with the product options the customer has selected?