I am extending the `ProductLine.Stock.View` on the...
# suitecommerce
k
I am extending the
ProductLine.Stock.View
on the
PDP
component and returning a boolean based on the current selected items' stock levels which come from a custom field using:
Copy code
PDP.addToViewContextDefinition(
						"ProductLine.Stock.View",
						"showOutOfStockMessage",
						"boolean",
						function (context) {
							var stockBoolean, iteminfo;
								iteminfo = PDP.getSelectedMatrixChilds();
My question is - why / how is it determining which item is selected and whether or not to display the out of stock messaging if no item has been selected? It seems like there is something happening behind the scenes which is determining which item is being selected and the stock levels to return. • For example, this item: https://wt.wesspur.com/yale-xtc-16-climbing-rope is showing out of stock before any selection is made • This item is displaying correctly https://wt.wesspur.com/stable-braid-12mm-tree-rigging-rope • You can see some debugging in the console
My question is - How can I get the extension to only "fire" when a selection is made? That is - all selected matrix options are selected. I would think the
getSelectedMatrixChilds
would do that for me automatically already, but it appears to be doing something different.