You are here

function hook_commerce_product_valid_pre_calculation_product in Commerce Core 7

Lets modules invalidate a particular product during the sell price pre- calculation process.

Because the price table can very quickly accumulate millions of rows on complex websites, it is advantageous to prevent any unnecessary products from cluttering up the table. This hook allows modules to prevent pre-calculation on an individual product, which is especially useful when it is known that products meeting certain criteria will never be featured in Views and other displays where it might be sorted or filtered based on a calculated price.

Parameters

$product: The product being considered for sell price pre-calculation.

Return value

TRUE or FALSE indicating whether or not the product is valid.

See also

hook_commerce_product_valid_pre_calculation_rule()

1 invocation of hook_commerce_product_valid_pre_calculation_product()
commerce_product_valid_pre_calculation_product in modules/product_pricing/commerce_product_pricing.module
Determines if a given product should be considered for price pre-calculation.

File

modules/product_pricing/commerce_product_pricing.api.php, line 28
Hooks provided by the Product Pricing module.

Code

function hook_commerce_product_valid_pre_calculation_product($product) {

  // Disable sell price pre-calculation for inactive products.
  if (!$product->status) {
    return FALSE;
  }
}