Skip to content

Commit

Permalink
Merge pull request #110 from bold-commerce/CHK-6273
Browse files Browse the repository at this point in the history
CHK-6273 - When building the array of shipping rates, for the selected shipping …
  • Loading branch information
DanielNordstrom authored Nov 1, 2024
2 parents 28ee37d + 3c31ce8 commit f37f86a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Service/ExpressPay/QuoteConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,16 @@ static function (Rate $rate) use (&$usedRateCodes): bool {

if ($hasRequiredAddressData && count($shippingRates) > 0) {
$convertedQuote['order_data']['shipping_options'] = array_map(
static function (Rate $rate) use ($currencyCode): array {
static function (Rate $rate) use ($currencyCode, $shippingAddress): array {
$price = ($rate->getCode() === $shippingAddress->getShippingMethod())
? $shippingAddress->getShippingAmount() : $rate->getPrice();
return [
'id' => $rate->getCode(),
'label' => trim("{$rate->getCarrierTitle()} - {$rate->getMethodTitle()}", ' -'),
'type' => 'SHIPPING',
'amount' => [
'currency_code' => $currencyCode ?? '',
'value' => number_format((float)$rate->getPrice(), 2)
'value' => number_format((float)$price, 2)
]
];
},
Expand Down

0 comments on commit f37f86a

Please sign in to comment.