@@ -68,6 +68,17 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
6868
6969export default async function Product ( { params, searchParams } : Props ) {
7070 const { locale, slug } = await params ;
71+ const options = await searchParams ;
72+
73+ const optionValueIds = Object . keys ( options )
74+ . map ( ( option ) => ( {
75+ optionEntityId : Number ( option ) ,
76+ valueEntityId : Number ( options [ option ] ) ,
77+ } ) )
78+ . filter (
79+ ( option ) => ! Number . isNaN ( option . optionEntityId ) && ! Number . isNaN ( option . valueEntityId ) ,
80+ ) ;
81+
7182 const customerAccessToken = await getSessionCustomerAccessToken ( ) ;
7283 const detachedWishlistFormId = 'product-add-to-wishlist-form' ;
7384
@@ -91,17 +102,6 @@ export default async function Product({ params, searchParams }: Props) {
91102 }
92103
93104 const streamableProduct = Streamable . from ( async ( ) => {
94- const options = await searchParams ;
95-
96- const optionValueIds = Object . keys ( options )
97- . map ( ( option ) => ( {
98- optionEntityId : Number ( option ) ,
99- valueEntityId : Number ( options [ option ] ) ,
100- } ) )
101- . filter (
102- ( option ) => ! Number . isNaN ( option . optionEntityId ) && ! Number . isNaN ( option . valueEntityId ) ,
103- ) ;
104-
105105 const variables = {
106106 entityId : Number ( productId ) ,
107107 optionValueIds,
@@ -122,6 +122,8 @@ export default async function Product({ params, searchParams }: Props) {
122122 const streamableProductInventory = Streamable . from ( async ( ) => {
123123 const variables = {
124124 entityId : Number ( productId ) ,
125+ optionValueIds,
126+ useDefaultOptionSelections : true ,
125127 } ;
126128
127129 const product = await getStreamableProductInventory ( variables , customerAccessToken ) ;
@@ -155,17 +157,6 @@ export default async function Product({ params, searchParams }: Props) {
155157 } ) ;
156158
157159 const streamableProductPricingAndRelatedProducts = Streamable . from ( async ( ) => {
158- const options = await searchParams ;
159-
160- const optionValueIds = Object . keys ( options )
161- . map ( ( option ) => ( {
162- optionEntityId : Number ( option ) ,
163- valueEntityId : Number ( options [ option ] ) ,
164- } ) )
165- . filter (
166- ( option ) => ! Number . isNaN ( option . optionEntityId ) && ! Number . isNaN ( option . valueEntityId ) ,
167- ) ;
168-
169160 const currencyCode = await getPreferredCurrencyCode ( ) ;
170161
171162 const variables = {
0 commit comments