Bright WooCommerce Integrations Actions And Filters

Instead of using the default license key name when creating a license key, you can add your own function:

For example, to get a license key like this:

21051-64391-74916-16898

Use a block like

public static function generate_license_key($key) {
  $digits = 5;

  $key = rand(pow(10, $digits-1), pow(10, $digits)-1) . '-' .
    rand(pow(10, $digits-1), pow(10, $digits)-1) . '-' .
    rand(pow(10, $digits-1), pow(10, $digits)-1) . '-' .
    rand(pow(10, $digits-1), pow(10, $digits)-1);
  return $key;
}

add_filter( 'bright_license_key_name', 'generate_license_key', 10, 1 ); 

Override the order details block included in emails and the order details page

By default, when creating a license key, the # of available seats for each course in the order is equal to the quantity of the items purchased.

Use this filter to replace this logic. For example, this block will make the # of available seats be the SUM of all product quantities in the order:

add_filter('bright_woocommerce_determine_quantity', function ($quantity, $data) {
  $items = \Bright\extractFromArray($data,'items', array());

  $total_quantity = 0;
  foreach($items as &$item) 
    $total_quantity += $item->get_quantity();

  return $total_quantity;
}, 10, 2);