@@ -181,7 +181,10 @@ const reshapeProduct = (product: ShopifyProduct, filterHiddenProducts: boolean =
181
181
return {
182
182
...rest ,
183
183
images : reshapeImages ( images , product . title ) ,
184
- variants : removeEdgesAndNodes ( variants )
184
+ variants : removeEdgesAndNodes ( variants ) . map ( ( v ) =>
185
+ // We'll make at least one variant unavailable for sale to demonstrate the feature.
186
+ v . title === 'Vintage Black / L' ? { ...v , availableForSale : false } : v
187
+ )
185
188
} ;
186
189
} ;
187
190
@@ -333,14 +336,29 @@ export async function getCollections(): Promise<Collection[]> {
333
336
// Filter out the `hidden` collections.
334
337
// Collections that start with `hidden-*` need to be hidden on the search page.
335
338
...reshapeCollections ( shopifyCollections ) . filter (
336
- ( collection ) => ! collection . handle . startsWith ( 'hidden' )
339
+ ( collection ) =>
340
+ ! collection . handle . startsWith ( 'hidden' ) &&
341
+ // These collections have no products
342
+ ! [ 'antiperistaltic-gold-socks' , 'blistered-aluminum-boat' , 'frontpage' ] . includes (
343
+ collection . handle
344
+ )
337
345
)
338
346
] ;
339
347
340
348
return collections ;
341
349
}
342
350
343
351
export async function getMenu ( handle : string ) : Promise < Menu [ ] > {
352
+ if ( handle === 'next-js-frontend-header-menu' ) {
353
+ return [
354
+ { title : 'All' , path : '/search' } ,
355
+ { title : 'Latest Stuff' , path : '/search/latest-stuff' } ,
356
+ { title : 'Casual Things' , path : '/search/casual-things' }
357
+ ] ;
358
+ } else if ( handle === 'next-js-frontend-footer-menu' ) {
359
+ return [ { title : 'Home' , path : '/' } ] ;
360
+ }
361
+
344
362
const res = await shopifyFetch < ShopifyMenuOperation > ( {
345
363
query : getMenuQuery ,
346
364
tags : [ TAGS . collections ] ,
0 commit comments