You are here

public function Shipment::clearRate in Commerce Shipping 8.2

Clears the shipment's rate, its shipping service & method.

Return value

$this

Overrides ShipmentInterface::clearRate

File

src/Entity/Shipment.php, line 92

Class

Shipment
Defines the shipment entity class.

Namespace

Drupal\commerce_shipping\Entity

Code

public function clearRate() {
  $fields = [
    'amount',
    'original_amount',
    'shipping_method',
    'shipping_service',
  ];
  foreach ($fields as $field) {
    $this
      ->set($field, NULL);
  }
  return $this;
}