public function Test::calculateRates in Commerce Shipping 8.2
Calculates rates for the given shipment.
Parameters
\Drupal\commerce_shipping\Entity\ShipmentInterface $shipment: The shipment.
Return value
\Drupal\commerce_shipping\ShippingRate[] The rates.
Overrides ShippingMethodInterface::calculateRates
File
- tests/
modules/ commerce_shipping_test/ src/ Plugin/ Commerce/ ShippingMethod/ Test.php, line 35
Class
- Test
- Provides the Test shipping method.
Namespace
Drupal\commerce_shipping_test\Plugin\Commerce\ShippingMethodCode
public function calculateRates(ShipmentInterface $shipment) {
$rate_id = 0;
$amount = new Price('0', 'USD');
$rates = [];
$rates[] = new ShippingRate($rate_id, $this->services['default'], $amount);
return $rates;
}