@@ -27,6 +27,7 @@ import {
2727 getProductPricingAndRelatedProducts ,
2828 getStreamableInventorySettingsQuery ,
2929 getStreamableProduct ,
30+ getStreamableProductInventory ,
3031 getStreamableProductVariant ,
3132} from './page-data' ;
3233
@@ -117,8 +118,22 @@ export default async function Product({ params, searchParams }: Props) {
117118
118119 const streamableProductSku = Streamable . from ( async ( ) => ( await streamableProduct ) . sku ) ;
119120
121+ const streamableProductInventory = Streamable . from ( async ( ) => {
122+ const variables = {
123+ entityId : Number ( productId ) ,
124+ } ;
125+
126+ const product = await getStreamableProductInventory ( variables , customerAccessToken ) ;
127+
128+ if ( ! product ) {
129+ return notFound ( ) ;
130+ }
131+
132+ return product ;
133+ } ) ;
134+
120135 const streamableProductVariant = Streamable . from ( async ( ) => {
121- const product = await streamableProduct ;
136+ const product = await streamableProductInventory ;
122137
123138 if ( ! product . inventory . hasVariantInventory ) {
124139 return undefined ;
@@ -188,7 +203,7 @@ export default async function Product({ params, searchParams }: Props) {
188203 } ) ;
189204
190205 const streameableCtaLabel = Streamable . from ( async ( ) => {
191- const product = await streamableProduct ;
206+ const product = await streamableProductInventory ;
192207
193208 if ( product . availabilityV2 . status === 'Unavailable' ) {
194209 return t ( 'ProductDetails.Submit.unavailable' ) ;
@@ -206,7 +221,7 @@ export default async function Product({ params, searchParams }: Props) {
206221 } ) ;
207222
208223 const streameableCtaDisabled = Streamable . from ( async ( ) => {
209- const product = await streamableProduct ;
224+ const product = await streamableProductInventory ;
210225
211226 if ( product . availabilityV2 . status === 'Unavailable' ) {
212227 return true ;
@@ -253,7 +268,7 @@ export default async function Product({ params, searchParams }: Props) {
253268
254269 const streamableStockDisplayData = Streamable . from ( async ( ) => {
255270 const [ product , variant , inventorySetting ] = await Streamable . all ( [
256- streamableProduct ,
271+ streamableProductInventory ,
257272 streamableProductVariant ,
258273 streamableInventorySettings ,
259274 ] ) ;
@@ -343,7 +358,7 @@ export default async function Product({ params, searchParams }: Props) {
343358
344359 const streamableBackorderDisplayData = Streamable . from ( async ( ) => {
345360 const [ product , variant , inventorySetting ] = await Streamable . all ( [
346- streamableProduct ,
361+ streamableProductInventory ,
347362 streamableProductVariant ,
348363 streamableInventorySettings ,
349364 ] ) ;
0 commit comments