Plugin Integration
Download and include the license server client in your project. To integrate to a plugin, add the following lines to your plugin’s main file.
WC_Software_License_Client::get_instance( $license_server_url, $base_file, $software_type );
$license_server_url – Is the domain of the license server.
$base_file – Is the plugin main file for a plugin or the theme root folder for the theme.
$software_type – Specify if this is a plugin or theme, default is plugin.
Here is an example showing the integration of the client script to a plugin.
/** * Plugin Name : Test Plugin Name * Plugin URI : https://example.com/plugins/plugin-name * Description : Basic WordPress plugin to test Software License Server for WooCommerce * Text Domain : text_domain * Author URI : https://example.com * License : https://www.gnu.org/licenses/gpl-2.0.html * Version : 1.0.0 * Author : Author Name * Domain Path : /languages * SLSWC : plugin * Documentation URL: https://www.gnu.org/licenses/gpl-2.0.html * Required WP : 5.1 * Compatible To: 5.1 */ function test_slswc_client_for_plugin() { require_once 'includes/class-wc-software-license-client.php'; return WC_Software_License_Client::get_instance( 'http://example.com/', __FILE__ ); } add_action( 'plugins_loaded', 'test_slswc_client_for_plugin', 11 );