@@ -234,10 +234,17 @@ public function getShippingAddressRate($address)
234234 public function getShippingPriceInclTax ($ address )
235235 {
236236 $ rate = $ address ->getShippingRateByCode ($ address ->getShippingMethod ());
237- $ baseAmount = (float )$ rate ->getPrice ();
238- $ baseTaxAmount = (float )$ address ->getBaseShippingTaxAmount ();
239237 $ store = $ this ->getQuote ()->getStore ();
240- $ converted = $ store ->getBaseCurrency ()->convert ($ baseAmount + $ baseTaxAmount , $ store ->getCurrentCurrencyCode ());
238+ $ baseCode = $ store ->getBaseCurrencyCode ();
239+ $ currentCode = $ store ->getCurrentCurrencyCode ();
240+ if ($ baseCode === $ currentCode ) {
241+ $ displayAmount = (float )$ rate ->getPrice () + (float )$ address ->getShippingTaxAmount ();
242+ return $ this ->formatPrice ($ displayAmount );
243+ }
244+ $ baseAmount = (float )$ rate ->getPrice ();
245+ $ baseTaxAmount = $ address ->getBaseShippingTaxAmount ();
246+ $ baseTaxAmount = $ baseTaxAmount !== null ? (float )$ baseTaxAmount : 0.0 ;
247+ $ converted = $ store ->getBaseCurrency ()->convert ($ baseAmount + $ baseTaxAmount , $ currentCode );
241248 return $ this ->formatPrice ($ converted );
242249 }
243250
@@ -250,9 +257,14 @@ public function getShippingPriceInclTax($address)
250257 public function getShippingPriceExclTax ($ address )
251258 {
252259 $ rate = $ address ->getShippingRateByCode ($ address ->getShippingMethod ());
253- $ baseAmount = (float )$ rate ->getPrice ();
254260 $ store = $ this ->getQuote ()->getStore ();
255- $ converted = $ store ->getBaseCurrency ()->convert ($ baseAmount , $ store ->getCurrentCurrencyCode ());
261+ $ baseCode = $ store ->getBaseCurrencyCode ();
262+ $ currentCode = $ store ->getCurrentCurrencyCode ();
263+ if ($ baseCode === $ currentCode ) {
264+ return $ this ->formatPrice ((float )$ rate ->getPrice ());
265+ }
266+ $ baseAmount = (float )$ rate ->getPrice ();
267+ $ converted = $ store ->getBaseCurrency ()->convert ($ baseAmount , $ currentCode );
256268 return $ this ->formatPrice ($ converted );
257269 }
258270
0 commit comments