You are here

public function ProductVariationStorageInterface::loadFromContext in Commerce Core 8.2

Loads the product variation from context.

Uses the variation specified in the URL (?v=) if it's active and belongs to the current product.

Note: The returned variation is not guaranteed to be enabled, the caller needs to check it against the list from loadEnabled().

Parameters

\Drupal\commerce_product\Entity\ProductInterface $product: The current product.

Return value

\Drupal\commerce_product\Entity\ProductVariationInterface The product variation.

1 method overrides ProductVariationStorageInterface::loadFromContext()
ProductVariationStorage::loadFromContext in modules/product/src/ProductVariationStorage.php
Loads the product variation from context.

File

modules/product/src/ProductVariationStorageInterface.php, line 39

Class

ProductVariationStorageInterface
Defines the interface for product variation storage.

Namespace

Drupal\commerce_product

Code

public function loadFromContext(ProductInterface $product);