@@ -111,7 +111,7 @@ ${HTMLTemplate.metaName('twitter:title', product.name)}
111
111
${ HTMLTemplate . metaName ( 'twitter:image' , image ?. url ) }
112
112
${ HTMLTemplate . metaName ( 'twitter:description' , product . metaDescription ) }
113
113
${ HTMLTemplate . metaName ( 'twitter:label1' , 'Price' ) }
114
- ${ HTMLTemplate . metaName ( 'twitter:data1' , product . prices . final . amount ) }
114
+ ${ HTMLTemplate . metaName ( 'twitter:data1' , product . prices ? .final ? .amount ) }
115
115
${ HTMLTemplate . metaName ( 'twitter:label2' , 'Availability' ) }
116
116
${ HTMLTemplate . metaName ( 'twitter:data2' , product . inStock ? 'In stock' : 'Out of stock' ) } `;
117
117
}
@@ -129,8 +129,8 @@ ${HTMLTemplate.metaName('externalId', product.externalId)}
129
129
${ HTMLTemplate . metaName ( 'addToCartAllowed' , product . addToCartAllowed ) }
130
130
${ HTMLTemplate . metaName ( 'inStock' , product . inStock ? 'true' : 'false' ) }
131
131
${ HTMLTemplate . metaProperty ( 'product:availability' , product . inStock ? 'In stock' : 'Out of stock' ) }
132
- ${ HTMLTemplate . metaProperty ( 'product:price.amount' , product . prices . final . amount ) }
133
- ${ HTMLTemplate . metaProperty ( 'product:price.currency' , product . prices . final . currency ) } `;
132
+ ${ HTMLTemplate . metaProperty ( 'product:price.amount' , product . prices ? .final ? .amount ) }
133
+ ${ HTMLTemplate . metaProperty ( 'product:price.currency' , product . prices ? .final ? .currency ) } `;
134
134
}
135
135
136
136
/**
@@ -271,8 +271,8 @@ ${HTMLTemplate.indent(this.renderProductItems(opt.items), 2)}`).join('\n')}
271
271
*/
272
272
renderVariantPrices ( prices ) {
273
273
return /* html */ `\
274
- <div>Regular: ${ prices . regular . amount } ${ prices . regular . currency } ${ HTMLTemplate . priceRange ( prices . regular . minimumAmount , prices . regular . maximumAmount ) } </div>
275
- <div>Final: ${ prices . final . amount } ${ prices . final . currency } ${ HTMLTemplate . priceRange ( prices . final . minimumAmount , prices . final . maximumAmount ) } </div>` ;
274
+ <div>Regular: ${ prices . regular ? .amount } ${ prices . regular ? .currency } ${ HTMLTemplate . priceRange ( prices . regular ? .minimumAmount , prices . regular ? .maximumAmount ) } </div>
275
+ <div>Final: ${ prices . final ? .amount } ${ prices . final ? .currency } ${ HTMLTemplate . priceRange ( prices . final ? .minimumAmount , prices . final ? .maximumAmount ) } </div>` ;
276
276
}
277
277
278
278
/**
@@ -292,7 +292,7 @@ ${this.variants.map((v) => /* html */`\
292
292
<div>${ v . name } </div>
293
293
<div>${ v . description } </div>
294
294
<div>${ v . inStock ? 'inStock' : '' } </div>
295
- ${ HTMLTemplate . indent ( this . renderVariantPrices ( v . prices ) , 4 ) }
295
+ ${ v . prices ? HTMLTemplate . indent ( this . renderVariantPrices ( v . prices ) , 4 ) : '' }
296
296
<div>
297
297
${ HTMLTemplate . indent ( this . renderVariantImages ( v . images ) , 6 ) }
298
298
</div>
0 commit comments