From ad127a9b2d447b85e52211135f01b7d7fb790f59 Mon Sep 17 00:00:00 2001 From: Abhishek Kathuria Date: Fri, 2 Sep 2022 11:36:57 +0530 Subject: [PATCH] Fixed issue #6377 --- packages/Webkul/Product/src/Type/Configurable.php | 2 +- .../products/view/configurable-options.blade.php | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/Webkul/Product/src/Type/Configurable.php b/packages/Webkul/Product/src/Type/Configurable.php index 70f0aa1dc..a85ec3bb6 100644 --- a/packages/Webkul/Product/src/Type/Configurable.php +++ b/packages/Webkul/Product/src/Type/Configurable.php @@ -643,7 +643,7 @@ class Configurable extends AbstractType } else { return '' . trans('shop::app.products.price-label') . '' . ' ' - . '' . core()->currency($this->evaluatePrice($this->getMinimalPrice())) . ''; + . '' . core()->currency($this->evaluatePrice($this->getMinimalPrice())) . ' '; } } diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/products/view/configurable-options.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/products/view/configurable-options.blade.php index 56a8e4143..fde5366d7 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/products/view/configurable-options.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/products/view/configurable-options.blade.php @@ -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; }