You are here

function uc_product_load_variant in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 uc_product/uc_product.module \uc_product_load_variant()

Loads a specific altered variant of a product node.

The (possibly cached) base product remains unaltered.

Parameters

$nid: The nid of the product to load.

array $data: Optional data to add to the product before invoking the alter hooks.

Return value

A variant of the product, altered based on the provided data, or FALSE if the node is not found.

9 calls to uc_product_load_variant()
AddToCartForm::validateForm in uc_product/src/Form/AddToCartForm.php
Form validation handler.
CartItem::postLoad in uc_cart/src/Entity/CartItem.php
Acts on loaded entities.
Products::addProductForm in uc_order/src/Plugin/Ubercart/OrderPane/Products.php
Sets the quantity and attributes of a product added to the order.
uc_product_kit_add_to_cart_form_validate in uc_product_kit/uc_product_kit.module
Form validation handler for adding a product kit to the cart.
uc_product_kit_node_load in uc_product_kit/uc_product_kit.module
Implements hook_node_load().

... See full list

File

uc_product/uc_product.module, line 187
The product module for Ubercart.

Code

function uc_product_load_variant($nid, $data = FALSE) {
  if ($node = Node::load($nid)) {
    return _uc_product_get_variant($node, $data);
  }
  else {
    return FALSE;
  }
}