By woocommerce-sl, posted on August 1, 2017

The key feature of every application is the speed, this plugin code is very well optimized (the difference from being inactive is approximately 0.07 seconds), so the faster code run the better overall performance. Google also put a huge accent on page loading speed, a better performance conclude to a better page rank and display position. On a WordPress instance, lot’s of other codes (plugins and theme) are loaded and executed, including WordPress framework core which generally makes the response time over several seconds. This also depends on the server architecture, expensive servers would run much faster than a regular cost machine.

But this is not all, as in a given time-frame, multiple users can navigate through your site and access different pages, imagine that server will need to process all these, accordingly.

Over the time, every shop increase it’s customer list, they come back to check with products download, update, account status etc. API interactions also increase if automatic product update functionality is used. Generally this conclude to an increase on server resources usage, most of the time shop owners end up by migrating to a better hosting, however with important additional costs. From our tests along other similar plugins on the market (i.e.WooCommerce API Manager) on a regular server (14$/ month) it would support maximum ~200 clients including API usage with products update. Remember that client software interact with API from time to time for update checking and other type of management (i.e. activation check, domain protection). Above the mentioned number, the processing speed decrease dramatically as customer list increase. Ultimately, the server admin may block your account for exceeding resources usage.

This is where our unique functionality Cache Module came in, it’s a very fast solution to speed up API interactions, releasing other server resources for a regular page load. Tests revealed that it’s 35 times faster than a regular WordPress call, making our product virtually capable to run a huge amount of API interactions (thousand per day), maintaining a very low server resources usage.

The overall speed on a large number of interactions (1000 calls), a regular server will need 114 seconds to process the data (under 2 minutes), while on other code 4259 seconds (near 71 minutes), away much longer.

The Cache Module is easy to deploy, this ca be done automatically through WordPress Dashboard at WooCommerce > Settings > Products > License Products, the Use Cache Module for API interactions  checkbox need to be selected.

Read more

By woocommerce-sl, posted on February 22, 2022

The WooCommerce Software License plugin provides a Cache Module for API interactions. This dramatically reduces the response time, preserving the server resources. That ensure other calls are also fast-forward processed. This is a unique functionality on the market, none of the other similar codes can provide such capability.
For a small business, this may not sound much. Few API calls over a time frame might not be an issue, after all.  The server can handle it with no bottleneck. Considering a growing perspective, that eventually becomes a real issue. Such a scenario is threatening your business as the host is unable to successfully process all incoming traffic. This is a vicious circle, as every new call on top of existing, with limited processing power, it conclude to an imminent break-up of the HTTP service. Worth mentioning the costs for a performance server, a dedicated machine go above $100 / month.  Using the Cache module, the plugin can easily handle thousands of API calls over a cheap hosting ( $10 /month ).

When using the Cache Module, just a small chunk of WordPress is loaded. There is no need for anything else, no themes files, either plugins assets. Just the core! That goes to an incredible response time, that gives enough room for many other API calls.

If the Cache Module is active, the WordPress filters can still run, including custom PHP code. Such filters are invoked through the add_filter function. To ensure the code is loaded by the cache module, the custom PHP block needs saved into /wp-content/mu-plugins/woosl-custom.php. That file is also loaded when turning off the Cache Module, as WordPress loads the Must-Use Plugins as default.

 

 

Read more

By woocommerce-sl, posted on July 31, 2017

The plugin include a very intuitive and simple to use License Product Expiration functionality. This provide an easy way to set expiration for licenses. No need to spend tons on money on additional tools like subscription application, membership etc this plugin support expiration out of the box!

The licence expire module is linked to other components like API, so any key usage are directly connected to status of product licence.

To set-up an expire for a lincesed product, the following options need to be filled in within Licence area on the product admin page. From below image, the Units 2 and Time Months means the licence will expire in 2 months from the time of purchase. (more…)

Read more

By woocommerce-sl, on , posted on January 17, 2020

Using Expiration for Products provides a way to set limited access to a Product, mainly set as downloadable content or generally dependent to licence key. The Expire setup is easy through the interfaces implemented by WP Software License plugin.

As default, on order completed the system set automatically the expire details, those consist on few details:

  • Subscription start date
  • Expiration date
  • Licence status

(more…)

Read more

By woocommerce-sl, on , posted on May 23, 2024

A license can be configured to allow multiple assignments to domains or devices, depending on the Product License setup. By default, when a customer purchases multiple quantities of a product, the system generates a corresponding number of license keys, up to the number of items purchased. (more…)

Read more

By woocommerce-sl, posted on September 29, 2022

When setting up the Licensing information for a Product, an Instance per License Key field is available to provide the number of domains that can be assigned towards a license key. This can be from 1 to unlimited.

When using a limited number of active domains, a Staging, Development or a Test may be required to not count towards an active instance. This is achievable programmatically using a filter.
For a domain to be considered as a staging or development, it must match a specific format. The following patterns can be used to determine if applys:

  • dev.
  • .dev
  • staging.
  • .local
  • localhost
  • test.
  • .test

The following code is using the above formats to make a comparison against the provided domain, inquired for a license key activation. The code should be placed within a custom file on /wp-content/mu-plugins/.

    add_filter ('WOOSL/API_call/activate/can_register_domain', '_woosl_api__can_register_domain', 10, 4 );
    function _woosl_api__can_register_domain( $can_register_domain_to_license_key, $domain, $key_instances, $max_instances_per_key )
        {
            //If already allowing more instances, just return
            if ( $can_register_domain_to_license_key )
                return TRUE;
             
            //check if the domain is actually a development
            $is_development_domain  =   TRUE;
            $regex_domain_development_check =   '/(^dev\.|\.dev$|^stage\.|^staging\.|\.local$|localhost|^test\.|\.test$)/i';   
            if ( preg_match( $regex_domain_development_check, $domain ) !== 1 )
                $is_development_domain  =   FALSE;
             
            //count the currently registered instances
            $count_production_instances     =   0;
            $count_dev_instances            =   0;
            
            foreach ( $key_instances    as  $key_instance )
                {
                    if ( preg_match( $regex_domain_development_check, $key_instance->active_domain ) !== 1 )
                        $count_production_instances +=  1;
                        else
                        $count_dev_instances    +=  1;
                }
            
            //We grant a single development one.
            if ( $is_development_domain &&  $count_dev_instances    <   1 )
                return TRUE;  
            
            if (    ! $is_development_domain    &&  $count_production_instances <   $max_instances_per_key )
                return TRUE;                   
                 
            return FALSE;   
        }

Accordingly to the above code logic, it allows a single staging/development domain registration. If already registered such a domain, it will not allow access for another activation.
In case of required unlimited activation, the code can be changed to the following:

    add_filter ('WOOSL/API_call/activate/can_register_domain', '_woosl_api__can_register_domain', 10, 4 );
    function _woosl_api__can_register_domain( $can_register_domain_to_license_key, $domain, $key_instances, $max_instances_per_key )
        {
            //If already allowing more instances, just return
            if ( $can_register_domain_to_license_key )
                return TRUE;
            
            //check if the domain is actually a development
            $regex_domain_development_check =   '/(^dev\.|\.dev$|^stage\.|^staging\.|\.local$|localhost|^test\.|\.test$)/i';   
            if ( preg_match( $regex_domain_development_check, $domain ) !== 1 )
                return FALSE;
            
            return TRUE;  
        }

Read more

By woocommerce-sl, on , posted on October 25, 2023

Managing licenses for your software products can be a tedious task, especially when you have multiple licenses to keep track of. That’s why the WP Software License for WooCommerce provides an easy-to-use All Licenses interface that allows administrators to manage all aspects of their licenses in one place.

The All Licenses interface is designed to provide administrators with a comprehensive view of their licenses and the ability to manage each license individually. Administrators can view the status of each license, including the product name, customer, license key, expiration details, license generation date, and active domains. (more…)

Read more

By woocommerce-sl, posted on August 8, 2024

The WooCommerce Software License plugin is a powerful tool designed to manage software licenses within a WooCommerce-powered store. It provides an intuitive interface that allows customers to view and manage their licenses directly from their account dashboard. The plugin includes two key template files:

  1. my-licences.php: This template file is responsible for displaying all the licensed items associated with a customer’s account. It provides a comprehensive interface where customers can see their licenses and take various actions such as managing the license, viewing the associated order, or accessing subscription details.
  2. my-licence-manage.php: This template handles the management interface for a specific license tied to a particular order or subscription. It displays detailed information such as the license’s availability, status, license key, assigned domain, and offers action buttons for tasks like deleting or deactivating a license.

To customize these templates to better fit your theme’s design or functionality requirements, you can copy the files from the plugin’s template directory to your active theme’s WooCommerce template folder. This guide will walk you through the steps to safely customize these templates.

Understanding the Template Structure

  1. my-licences.php:
    • Purpose: This template generates the interface that lists all the licenses a customer holds. It is typically displayed on the “My Account” page under a section such as “My Licenses”.
    • Key Elements:
      • Licensed Items: A list of all the products that have an associated software license.
      • Action Buttons: Buttons allow customers to manage their license, view the order, or check subscription details.
      • User Experience: Designed to provide an at-a-glance overview of all licenses with easy access to detailed management options.
  2. my-licence-manage.php:
    • Purpose: This template is used to manage the details of a specific license, such as viewing the license key, managing domain assignments, and performing actions like deleting or deactivating the license.
    • Key Elements:
      • License Details: Displays essential information about the license, including its status, key, and the domain to which it is assigned.
      • Action Buttons: Provides the user with options to perform actions related to license management, such as deactivating a license or reassigning it to a different domain.
      • User Experience: Focused on providing detailed control over individual licenses, ensuring that customers can manage their software licenses effectively.

Steps to Customize the Templates

To customize the templates, follow these steps:

  1. Locate the Original Template Files:
    • The original template files are located in the plugin directory: /wp-content/plugins/woocommerce-software-license/templates/myaccount/.
    • The files you need are my-licences.php and my-licence-manage.php.
  2. Copy the Templates to Your Theme:
    • Create a new directory within your active theme to store the WooCommerce custom templates. The path should be: /wp-content/themes/your-theme/woocommerce/myaccount/.
    • Copy my-licences.php and my-licence-manage.php from the plugin directory to the newly created directory in your theme.
  3. Customize the Templates:
    • Open the copied template files in a code editor.
    • Modify the HTML, CSS, or PHP code as needed to match your theme’s design or to add new functionalities. Be mindful of the code structure and ensure that any WooCommerce hooks or functions are properly integrated.
    • Important Note: Always test your changes on a staging site before applying them to your live site. This ensures that your customizations do not disrupt the site’s functionality.
  4. Save and Test:
    • After making the necessary changes, save the files and upload them to your server if you’re working locally.
    • Visit the “My Account” page on your site to review the changes. Ensure that both the license listing and management interfaces display correctly and that all functionalities work as expected.

Tips for Customization

  • Use Child Themes: If you are working with a parent theme, it’s advisable to create a child theme and place your custom templates there. This ensures that your customizations are preserved during theme updates.
  • Follow WooCommerce Standards: When customizing WooCommerce templates, try to adhere to WooCommerce’s coding standards and practices. This helps maintain compatibility and ensures that your customizations are future-proof.
  • Keep Backups: Always keep a backup of the original files before making any changes. This allows you to revert to the default behavior if needed.

Final Thoughts

Customizing the my-licences.php and my-licence-manage.php template files allows you to tailor the WooCommerce Software License plugin’s interface to better suit your site’s design and functionality requirements. By following the steps outlined above, you can safely modify these templates, providing your customers with a seamless and personalized experience when managing their software licenses. Always remember to test thoroughly and consider using version control to track changes over time.

Read more

By woocommerce-sl, posted on November 17, 2017

Once checked-out, the licensing data will be saved as meta data, into customer order, according to product licensing set-up. The order licensing meta data will stay as is even if the product licensing will modify over time.

There are cased when changing the product license groups is required to be updated for specific orders. This can be achieved through a custom code:

include ('wp-config.php');

    global $post, $WOO_SL;
    
    
    $product_ID =   10;
    $order_ID   =   132546;
    
    
    $order = new WC_Order( $order_ID );
    
    $order_products = $order->get_items();
    $found_licensed_product = FALSE;
    foreach($order_products as $key => $order_product)
        {
            if (WOO_SL_functions::is_product_licensed($order_product['product_id']) &&  $order_product['product_id']    ==  $product_ID )
                {
                    $found_licensed_product = TRUE;
                    break;
                }
        }
        
        
    if (!$found_licensed_product)
        {
            echo "The Order does not contain the specified product or is not licensed.";
            die();
        }
        
    foreach($order_products as $order_item_key => $order_product)
        {
            if ( ! WOO_SL_functions::is_product_licensed($order_product['product_id']) ||  $order_product['product_id']    !=  $product_ID )
                continue;
            
           
            /**
            *
            * Generate  keys
            * @var {WOO_SL_functions|WOO_SL_functions}
            */
            $_woo_sl = WOO_SL_functions::get_order_item_meta($order_item_key, '_woo_sl', TRUE);
            
            $get_product_groups =   get_post_meta($order_product['product_id'], '_sl_groups', TRUE);
            
            //reindex the $_woo_sl
            $_woo_sl    =   array(
                                    'group_title'           =>  array(),
                                    'licence_prefix'        =>  array(),
                                    'max_keys'              =>  array(),
                                    'max_instances_per_key' =>  array(),
                                    'use_predefined_keys'   =>  array()  
                                    );
                                    
            foreach($get_product_groups as  $key    =>  $group_data)
                {
                    $_woo_sl['group_title'][$key]           =   $group_data['group_title'];
                    $_woo_sl['licence_prefix'][$key]        =   $group_data['licence_prefix'];
                    $_woo_sl['max_keys'][$key]              =   $group_data['max_keys'];
                    $_woo_sl['max_instances_per_key'][$key] =   $group_data['max_instances_per_key'];
                    $_woo_sl['use_predefined_keys'][$key]   =   $group_data['use_predefined_keys'];
                    
                }
                
                
            wc_update_order_item_meta ( $order_item_key, '_woo_sl', $_woo_sl );
                
            echo "Completed";
            
        }

The above code should be placed within a file saved in WordPress root.
There are 2 variables within the code which require to be changed for site specific:

  • $product_ID – The product for which the licensing groups where changed
  • $order_ID – The order ID for which the groups should be changed
  • Previous order generated licence keys will not lost, they will be assigned to the same group as before, unless it has been removed.

    Read more

By woocommerce-sl, on , posted on June 15, 2023

WooCommerce is a popular e-commerce platform that provides users with a wide range of plugins to enhance their online stores. One such plugin is the WooCommerce Software License plugin, which allows store owners to manage and distribute software licenses to their customers. A key feature of this plugin is the client interface, which empowers customers to manage their license keys. However, there is also an option to disable this feature from the administrator’s perspective. In this article, we will explore the benefits and considerations of using the client interface in the WooCommerce Software License plugin.
(more…)

Read more