This commit is contained in:
Abhishek Kathuria 2022-09-02 11:36:57 +05:30
parent d273914769
commit ad127a9b2d
2 changed files with 14 additions and 3 deletions

View File

@ -643,7 +643,7 @@ class Configurable extends AbstractType
} else {
return '<span class="price-label">' . trans('shop::app.products.price-label') . '</span>'
. ' '
. '<span class="final-price">' . core()->currency($this->evaluatePrice($this->getMinimalPrice())) . '</span>';
. '<span class="special-price">' . core()->currency($this->evaluatePrice($this->getMinimalPrice())) . '</span> <span class="regular-price"></span>';
}
}

View File

@ -314,7 +314,7 @@
});
let priceLabelElement = document.querySelector('.price-label');
let priceElement = document.querySelector('.final-price');
let priceElement = document.querySelector('.special-price');
let regularPriceElement = document.querySelector('.regular-price');
if (this.childAttributes.length == selectedOptionCount) {
@ -322,7 +322,18 @@
priceElement.innerHTML = this.config.variant_prices[this.simpleProduct].final_price.formated_price;
if (regularPriceElement) {
if (
this.config.variant_prices[this.simpleProduct].regular_price.formated_price == "$0.00"
|| this.config.variant_prices[this.simpleProduct].regular_price.formated_price == this.config.variant_prices[this.simpleProduct].final_price.formated_price
) {
regularPriceElement.innerHTML = "";
}
if (
regularPriceElement
&& this.config.variant_prices[this.simpleProduct].regular_price.formated_price != "$0.00"
&& this.config.variant_prices[this.simpleProduct].regular_price.formated_price != this.config.variant_prices[this.simpleProduct].final_price.formated_price
) {
regularPriceElement.innerHTML = this.config.variant_prices[this.simpleProduct].regular_price.formated_price;
}