Actions / Filters

By woocommerce-sl, posted on April 24, 2025

Type
Filter

Arguments
(string) $text

Description
Change the default HTML menu item text ‘License Manage’

Example of usage

Change the default text to something else

    add_filter('woo_sl/html/menu/license_manage', 'custom_html_menu_license_manage');
    function custom_html_menu_license_manage( $text )
        {
            
            $text = __('License Administration', 'software-license');
               
            return $text;   
        }

 

 

Read more

By woocommerce-sl, posted on April 24, 2025

Type
Filter

Arguments
(string) $text

Description
Change the default HTML button text ‘License Manage’

Example of usage

Change the default text to something else

    add_filter('woo_sl/html/button/license_manage', 'custom_html_button_license_manage');
    function custom_html_button_license_manage( $text )
        {
            
            $text = __('Keys Handling', 'software-license');
               
            return $text;   
        }

 

 

Read more

By woocommerce-sl, posted on November 25, 2023

Type
Filter

Arguments
(array) $disabled_buttons
(int) $licence_data_id
(text) $domain

Description
This filter serves to deactivate particular buttons within the License Management interface, offering enhanced control and customization over the functionality of the interface.

Example of usage
The following sample code removes the Delete button.

    add_filter('woo_sl/license_manage/get_disabled_buttons', '_licence_manage_get_disabled_buttons', 10, 3);
    function _licence_manage_get_disabled_buttons( $disabled_buttons, $licence_id, $domain )
        {
            $disabled_buttons['delete']   =   TRUE;
             
            return  $disabled_buttons;   
        }

Read more

By woocommerce-sl, posted on August 2, 2017

Type
Filter

Arguments
(array) $disabled_buttons
(int) $licence_data_id
(text) $domain

Description
This filter is designed to deactivate and block specific actions within the License Management interface, providing enhanced control and restriction over available functionalities.

Example of usage
The following sample code disable the Delete action. You can remove the Delete button using the following filter woo_sl/license_manage/disabled_buttons

    add_filter('woo_sl/license_manage/disabled_actions', '_licence_manage_disabled_actions', 10, 3);
    function _licence_manage_disabled_actions($ignore_actions, $licence_id, $domain)
        {
            $ignore_actions['delete']   =   FALSE;
             
            return  $ignore_actions;   
        }

Read more

By woocommerce-sl, posted on August 2, 2017

Type – Filter
Arguments – 4 ( (intval)1, $order_id, $order_item_id, $key)

Read more

By woocommerce-sl, posted on August 2, 2017

Type – Filter
Arguments – 3 ($data, $order_product, $order_id)

Read more

By woocommerce-sl, posted on August 2, 2017

Type – Filter
Arguments – 2 ($_woo_sl_licensing_status, $order_item_id)

Read more

By woocommerce-sl, posted on August 2, 2017

Name
woo_sl/get_order_licence_details

Type
Filter

Arguments
(array) $order_licence_details
(int) $order_id

Description
Filter returned licence details for a product order.

Read more

By woocommerce-sl, posted on September 22, 2018

Type
Action

Arguments
(integer) $product_id
(string) $license_group_title

Description
Trigger when key extracted successfully from predefined keys list.

Example of usage

The following code send a message to admin when the number of keys is under 10

    add_action('woo_sl/generate_license_key/predefined_keys', 'custom_do_on_predefined_key_use');
    function custom_do_on_predefined_key_use( $product_id, $license_group_title )
        {
            
            $_sl_groups =   WOO_SL_functions::get_product_licensing_groups( $product_id );   
                                                                                     
            foreach($_sl_groups as  $key     => $_sl_group)
                {
                    if($_sl_group['group_title']    !=  $license_group_title )
                        continue;
                    
                    if(count($key_list) <   10)    
                        {
                            $product_post   =   get_post($product_id);
                            
                            //send a notice to admin
                            $to             =   'admin@mywebsite.com';
                            $subject        =   'Predefined List is getting low on keys';
                            $body           =   'The product ' .$product_post->post_title .' ( ID ' . $product_id . ' ) contain only ' . count($key_list) . ' keys';
                            $headers        =   array('Content-Type: text/html; charset=UTF-8');
                             
                            wp_mail( $to, $subject, $body, $headers );   
                            
                        }
                        
                    break;
                }   
        }

Read more

By woocommerce-sl, posted on May 3, 2022

Name
woo_sl/cron/process_licence_expire_notifications

Type
Filter

Arguments
(array) $items

Description
The filter allows interaction with the result items, that need processed and send expire notifications.

Example of usage
The following code check for any orders that include product ID 128 and remove the expire notification email for that record.

    add_filter ('woo_sl/cron/process_licence_expire_notifications', '_woo_sl_cron_process_licence_expire_notifications');
    function _woo_sl_cron_process_licence_expire_notifications( $items )
        {
            if ( ! is_array ( $items )  ||  count  ( $items )   <   1 )
                return $items; 
            
            foreach ( $items    as  $key    =>  $item )
                {
                    $order_id   =   WOO_SL_functions::get_order_by_item_id( $item->order_item_id );
                    
                    //create the order object
                    $order_data =   new WC_Order ( $order_id );
                    
                    //retrieve the order items
                    $order_items    =   $order_data->get_items();
                    
                    //loop the items
                    foreach ( $order_items  as $order_item ) 
                        {
                            $item_product   =   $order_item->get_product();
                            
                            $product_ID     =   $item_product->get_ID();
                            if ( $product_ID == 128 )
                                unset ( $items[ $key ] );
                        }
                }
            
            return $items;   
        }

Read more