Kevin Carpenter
12/29/2022, 10:00 AMKevin Carpenter
12/29/2022, 10:24 AMfor (var i = 0; i < itemInfoObj.options.length; i++) {
if (itemInfoObj.options[i].type == 'select') {
var cartOptionId = itemInfoObj.options[i].cartOptionId;
var firstInternalId = itemInfoObj.options[i].values[1].internalid;
// if there are no query string parameters present
if (window.location.search == "") {
// set the first option via pdp.setOption
PDP.setOption(cartOptionId, firstInternalId);
}
}
}
pablod
12/29/2022, 4:49 PMKevin Carpenter
12/29/2022, 5:53 PMKevin Carpenter
12/29/2022, 5:54 PMSteve Goldberg
01/03/2023, 1:34 PMLC
01/03/2023, 8:01 PMPDP.on('afterShowContent', function(){}
PDP.on('afterOptionSelection', function(){}
The first one will allow you to manage the scenario if the user reloads the page... and the second one is triggered after the options are selected.
Those two were a huge help when working on a customization on the product detail level and managing matrix items