UPS shipping method not displayed during manual shipment addition

Created on 1 May 2024, 8 months ago

Details:
When manually adding a shipment to an order via the route "/admin/commerce/orders/{commerce_order}/shipments/add/{commerce_shipment_type}", the UPS shipping method fails to appear.

Cause:
The method calculateRates in the shipment handling script only attempts to fetch shipping rates if the shipment already has an address associated with it. Here's the relevant code segment:


public function calculateRates(ShipmentInterface $shipment) {
    // Rates are fetched only if there is an existing address on the shipment profile
    if ($shipment->getShippingProfile()->get('address')->isEmpty()) {
        return [];  // No rates are returned if the address is absent
    }

    // Fetch and return UPS rates if an address is present
    return $this->upsRateService->getRates($shipment, $this->parentEntity);
}
Feature request
Status

Closed: works as designed

Version

3.0

Component

Code

Created by

🇵🇹Portugal introfini

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @introfini
  • Status changed to Closed: works as designed 8 months ago
  • 🇵🇹Portugal introfini

    The solution is straightforward: just add a new address in the new shipping form and click the 'Recalculate shipping' button. This action will display the UPS shipping method with shipping rates.

Production build 0.71.5 2024