By woocommerce-sl, on , , posted on August 2, 2017

By default, whenever a client purchases a licensed product, a single key is generated and saved within the account. This can be changed through the filter woo_sl/generate_licence_keys_count. Multiple keys can be generated in a row, or none.

The example bellow change the default single key generator to all allowed for current licence group:

add_action('woo_sl/generate_licence_keys_count', 'woo_sl_generate_licence_keys_count', 10,  4);
    function woo_sl_generate_licence_keys_count($generate_keys_count, $order_id, $order_item_id, $license_group_id)
        {
            global $WOO_SL_API;
            
            $_woo_sl    =   $WOO_SL_API->functions->get_order_item_meta($order_item_id,  '_woo_sl',  TRUE);
            
            $group_max_allowed_keys     =   $_woo_sl['max_keys'][$license_group_id];
            
            return $group_max_allowed_keys;   
        }

If the order contain multiple quantity of an item, the user will be able to generate a maximum_group_licence_keys multiplied with quantity. So accordingly the code become something like this:

add_action('woo_sl/generate_licence_keys_count', 'woo_sl_generate_licence_keys_count', 10,  4);
    function woo_sl_generate_licence_keys_count($generate_keys_count, $order_id, $order_item_id, $license_group_id)
        {
            global $WOO_SL_API;
            
            $_woo_sl    =   $WOO_SL_API->functions->get_order_item_meta($order_item_id,  '_woo_sl',  TRUE);
            
            $group_max_allowed_keys     =   $_woo_sl['max_keys'][$license_group_id];

            $order_data         = new WC_Order($order_id);
            $order_products     = $order_data->get_items();

            $order_item_data    = $order_products[$order_item_id];
            $quantity           = $order_item_data['qty'];
            
            return ($quantity * $group_max_allowed_keys);
        }

Read more

By woocommerce-sl, on , posted on August 1, 2017

As default the WP Software License plugin output a ‘X domains per key’ within the order page, client and admin e-mails, my account areas etc. This is because is presumed the purchasable is being linked to a domain (e.g. a downloadable software).

But this is not necessarily to say that way, arbitrary texts can be used depending on the Product type and profile. (more…)

Read more

By woocommerce-sl, on , posted on August 1, 2017

Assigning license groups to variation products in WooCommerce is a powerful feature of the WP Software License plugin. This functionality provides enhanced flexibility and control over licensing management, allowing businesses to tailor licensing options for individual product variation. (more…)

Read more

By woocommerce-sl, on , posted on August 1, 2017

Name
woo_sl/generate_license_key

Type
Filter

Arguments
(text) $license_key
(int) $order_id
(int) $order_item_id
(int) $license_group_id (more…)

Read more