File tree Expand file tree Collapse file tree
vibes/soul/primitives/product-card Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ export default async function Brand(props: Props) {
133133 const products = search . products . items ;
134134
135135 const { defaultOutOfStockMessage, showOutOfStockMessage, showBackorderMessage } =
136- settings ?. inventory || { } ;
136+ settings ?. inventory ?? { } ;
137137
138138 return productCardTransformer (
139139 products ,
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ export default async function Category(props: Props) {
146146 const products = search . products . items ;
147147
148148 const { defaultOutOfStockMessage, showOutOfStockMessage, showBackorderMessage } =
149- settings ?. inventory || { } ;
149+ settings ?. inventory ?? { } ;
150150
151151 return productCardTransformer (
152152 products ,
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ export default async function Search(props: Props) {
118118 const products = search . products . items ;
119119
120120 const { defaultOutOfStockMessage, showOutOfStockMessage, showBackorderMessage } =
121- settings ?. inventory || { } ;
121+ settings ?. inventory ?? { } ;
122122
123123 return productCardTransformer (
124124 products ,
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export default async function Home({ params }: Props) {
3737 const featuredProducts = removeEdgesAndNodes ( data . site . featuredProducts ) ;
3838
3939 const { defaultOutOfStockMessage, showOutOfStockMessage, showBackorderMessage } =
40- data . site . settings ?. inventory || { } ;
40+ data . site . settings ?. inventory ?? { } ;
4141
4242 return productCardTransformer (
4343 featuredProducts ,
@@ -53,7 +53,7 @@ export default async function Home({ params }: Props) {
5353 const newestProducts = removeEdgesAndNodes ( data . site . newestProducts ) ;
5454
5555 const { defaultOutOfStockMessage, showOutOfStockMessage, showBackorderMessage } =
56- data . site . settings ?. inventory || { } ;
56+ data . site . settings ?. inventory ?? { } ;
5757
5858 return productCardTransformer (
5959 newestProducts ,
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const getInventoryMessage = (
2121 return undefined ;
2222 }
2323
24- const { availableForBackorder, unlimitedBackorder } = product . inventory . aggregated || { } ;
24+ const { availableForBackorder, unlimitedBackorder } = product . inventory . aggregated ?? { } ;
2525
2626 const hasBackorderAvailablity = ! ! availableForBackorder || unlimitedBackorder ;
2727
@@ -37,7 +37,7 @@ const getInventoryMessage = (
3737
3838 const inventoryByLocation = removeEdgesAndNodes ( baseVariant . inventory . byLocation ) . at ( 0 ) ;
3939
40- return inventoryByLocation ?. backorderMessage || undefined ;
40+ return inventoryByLocation ?. backorderMessage ?? undefined ;
4141} ;
4242
4343export const singleProductCardTransformer = (
Original file line number Diff line number Diff line change @@ -135,18 +135,19 @@ export function ProductCard({
135135 >
136136 { title }
137137 </ span >
138-
139- < span
140- className = { clsx (
141- 'mb-1.5 block text-sm font-normal' ,
142- {
143- light : 'text-[var(--product-card-light-subtitle,hsl(var(--foreground)/75%))]' ,
144- dark : 'text-[var(--product-card-dark-subtitle,hsl(var(--background)/75%))]' ,
145- } [ colorScheme ] ,
146- ) }
147- >
148- { subtitle }
149- </ span >
138+ { subtitle != null && subtitle !== '' && (
139+ < span
140+ className = { clsx (
141+ 'mb-1.5 block text-sm font-normal' ,
142+ {
143+ light : 'text-[var(--product-card-light-subtitle,hsl(var(--foreground)/75%))]' ,
144+ dark : 'text-[var(--product-card-dark-subtitle,hsl(var(--background)/75%))]' ,
145+ } [ colorScheme ] ,
146+ ) }
147+ >
148+ { subtitle }
149+ </ span >
150+ ) }
150151 { price != null && < PriceLabel colorScheme = { colorScheme } price = { price } /> }
151152 < span
152153 className = { clsx (
You can’t perform that action at this time.
0 commit comments