You are here

function commerce_product_validate_sku in Commerce Core 7

Checks to ensure a given SKU does not contain invalid characters.

Parameters

$sku: The string to validate as a SKU.

Return value

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

1 call to commerce_product_validate_sku()
commerce_product_product_form_validate in modules/product/includes/commerce_product.forms.inc
Validation callback for commerce_product_product_form().

File

modules/product/commerce_product.module, line 702
Defines the core Commerce product entity, including the entity itself, the bundle definitions (product types), and various API functions to manage products and interact with them through forms and autocompletes.

Code

function commerce_product_validate_sku($sku) {

  // Do not allow commas in a SKU.
  if (strpos($sku, ',') !== FALSE) {
    return FALSE;
  }
  return TRUE;
}