ShipmentController.php in Commerce Shipping 8.2
File
src/Controller/ShipmentController.php
View source
<?php
namespace Drupal\commerce_shipping\Controller;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\Core\Entity\Controller\EntityController;
class ShipmentController extends EntityController {
public function addShipmentPage(OrderInterface $commerce_order) {
$order_type = $this->entityTypeManager
->getStorage('commerce_order_type')
->load($commerce_order
->bundle());
$shipment_type = $order_type
->getThirdPartySetting('commerce_shipping', 'shipment_type', 'default');
return $this
->redirect('entity.commerce_shipment.add_form', [
'commerce_order' => $commerce_order
->id(),
'commerce_shipment_type' => $shipment_type,
]);
}
}