interface PackerInterface in Commerce Shipping 8.2
Creates one or more shipments for a given order.
Allows sites to automatically split an order into multiple shipments based on stock location, weight, dimensions, or some other criteria.
Important: A single order item can be added to multiple shipments only if all shipments are going to share the same shipping profile. This limitation is imposed by commerce_tax and TaxSubscriber which need to select a shipping profile for each order item.
Hierarchy
- interface \Drupal\commerce_shipping\Packer\PackerInterface
Expanded class hierarchy of PackerInterface
All classes that implement PackerInterface
4 files declare their use of PackerInterface
- PackerManager.php in src/
PackerManager.php - PackerManagerInterface.php in src/
PackerManagerInterface.php - PackerManagerTest.php in tests/
src/ Kernel/ PackerManagerTest.php - TestPacker.php in tests/
modules/ commerce_shipping_test/ src/ Packer/ TestPacker.php
File
- src/
Packer/ PackerInterface.php, line 20
Namespace
Drupal\commerce_shipping\PackerView source
interface PackerInterface {
/**
* Determines whether the packer applies to the given order.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $order
* The order.
* @param \Drupal\profile\Entity\ProfileInterface $shipping_profile
* The shipping profile.
*
* @return bool
* TRUE if the packer applies to the given order, FALSE otherwise.
*/
public function applies(OrderInterface $order, ProfileInterface $shipping_profile);
/**
* Packs the given order.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $order
* The order.
* @param \Drupal\profile\Entity\ProfileInterface $shipping_profile
* The shipping profile.
*
* @return \Drupal\commerce_shipping\ProposedShipment[]
* The proposed shipments.
*/
public function pack(OrderInterface $order, ProfileInterface $shipping_profile);
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PackerInterface:: |
public | function | Determines whether the packer applies to the given order. | 2 |
PackerInterface:: |
public | function | Packs the given order. | 2 |