File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
app/code/Magento/Catalog/Block/Product Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -232,26 +232,28 @@ public function getJsonConfig()
232
232
foreach ($ tierPricesList as $ tierPrice ) {
233
233
$ tierPrices [] = $ this ->priceCurrency ->convert ($ tierPrice ['price ' ]->getValue ());
234
234
}
235
+ $ regularPriceAmount = $ product ->getPriceInfo ()->getPrice ('regular_price ' )->getAmount ();
236
+ $ finalPriceAmount = $ product ->getPriceInfo ()->getPrice ('final_price ' )->getAmount ();
235
237
$ config = [
236
238
'productId ' => $ product ->getId (),
237
239
'priceFormat ' => $ this ->_localeFormat ->getPriceFormat (),
238
240
'prices ' => [
239
241
'oldPrice ' => [
240
- 'amount ' => $ this -> priceCurrency -> convert (
241
- $ product -> getPriceInfo ()-> getPrice ( ' regular_price ' )-> getAmount ()-> getValue ()
242
- ) ,
242
+ 'amount ' => $ regularPriceAmount
243
+ ? $ this -> priceCurrency -> convert ( $ regularPriceAmount -> getValue () )
244
+ : null ,
243
245
'adjustments ' => []
244
246
],
245
247
'basePrice ' => [
246
- 'amount ' => $ this -> priceCurrency -> convert (
247
- $ product -> getPriceInfo ()-> getPrice ( ' final_price ' )-> getAmount ()-> getBaseAmount ()
248
- ) ,
248
+ 'amount ' => $ finalPriceAmount
249
+ ? $ this -> priceCurrency -> convert ( $ finalPriceAmount -> getBaseAmount () )
250
+ : null ,
249
251
'adjustments ' => []
250
252
],
251
253
'finalPrice ' => [
252
- 'amount ' => $ this -> priceCurrency -> convert (
253
- $ product -> getPriceInfo ()-> getPrice ( ' final_price ' )-> getAmount ()-> getValue ()
254
- ) ,
254
+ 'amount ' => $ finalPriceAmount
255
+ ? $ this -> priceCurrency -> convert ( $ finalPriceAmount -> getValue () )
256
+ : null ,
255
257
'adjustments ' => []
256
258
]
257
259
],
You can’t perform that action at this time.
0 commit comments