Hello, I have a license that can be sold multiple times. When a customer places and order, the plugin gives the status of the license key to “delivered” and sends it. I want only for this particular key the status to always stay on “active” and that the plugin sends this particular key with every new order for this particular product. However, I can’t seem to find how to install that. Is that even possible?
I tried adding the following code in the functions.php file from my child theme but without success:
add_action(‘woocommerce_order_status_processing’, ‘reset_license_after_order’);
function reset_license_after_order($order_id) {
// Haal de bestelling op
$order = wc_get_order($order_id);
// Log de status van de bestelling
error_log("Order status is now: " . $order->get_status()); // Dit logt de huidige status van de bestelling
// Controleer of de bestelling het product heeft dat de licentie gebruikt
$target_product_id = XXXXX; // Product ID waarvoor we de licentie willen resetten
$target_license_id = XXXXX; // Licentie ID die we willen resetten
// Loop door de items in de bestelling en zoek naar het specifieke product
$license_updated = false;
foreach ($order->get_items() as $item_id => $item) {
$product_id = $item->get_product_id();
if ($product_id == $target_product_id) {
// Licentie reset nodig
global $wpdb;
// Gebruik de volledige tabelnaam zonder de prefix
$table_name = 'tabel-name'; // Volledige tabelnaam zonder de prefix
// Update de licentie status naar 'actief' (3) en verwijder de koppeling met klant en bestelling
$result = $wpdb->update(
$table_name,
array(
'status' => 3, // Actief
'user_id' => NULL, // Koppel klant los
'order_id' => NULL, // Koppel bestelling los
),
array('id' => $target_license_id), // Gebruik hier de kolomnaam 'id' in plaats van 'license_id'
array('%d', '%d', '%d'),
array('%d')
);
// Log de updates
if ($result !== false) {
error_log("License status updated for id: $target_license_id to 'actief'.");
error_log("License user_id set to NULL for id: $target_license_id.");
error_log("License order_id set to NULL for id: $target_license_id.");
$license_updated = true;
} else {
error_log("Failed to update license with id: $target_license_id");
}
// Tweede methode via directe SQL
$sql = $wpdb->prepare(
"UPDATE $table_name SET status = 3, user_id = NULL, order_id = NULL WHERE id = %d", // Gebruik de kolomnaam 'id'
$target_license_id
);
// Voer de query uit
$wpdb->query($sql);
// Log de directe SQL-update
error_log("Direct SQL update executed for id: $target_license_id");
}
}
// Als de licentie succesvol is bijgewerkt, log het resultaat
if ($license_updated) {
error_log("Licentie met id $target_license_id is opnieuw beschikbaar voor verkoop.");
}
}
]]>in wp-content\plugins\license-manager-woo\includes\Integrations\WooCommerceSubscriptions:
public function getCustomerLicenseKeys( $args ) returns null when ‘order’ is not included in the args.
I’m not sure why its being called on my non-subscription product after getCustomerLicenseKeys($order) from wp-content\plugins\license-manager-woo\includes\Integrations, but I was able to get it showing my license info by adding
public function getCustomerLicenseKeys( $args ) {
if (!isset($args['order'])) {
//Args does not contain 'order' key, return input.
return $args;
}
//rest of code
}
I just wanted to report in case this was a bug.
Hi, I was going crazy, but doing a test in Postman, I see that when I try to do a GET https://pacwoo.servidorbeta.es/wp-json/lmfwc/v2/licenses with the created keys, I get a 404 error.
]]>Hello,
I have the ��License Manager for WooCommerce�� plugin and I��m trying to override the Edit License Key & Add License Key pages and add another field,
I read the documentation and especially this part �C ��How to Edit Tempalte Files��(https://woocommerce.com/document/license-manager-woo-store-owner-guide)
and tried to override these files in this theme: mytheme/woocommerce/licenses/page-edit.php
Also in this directory: mytheme/woocommerce/page-edit.php
but nothing worked (overriding it directly in the plugin directory did work but I want to override it in my theme).
This is the plugin directory: plugins/license-manager-woo/templates/licenses/page-edit.php
I��d appreciate suggestions on how to override these files,
Thank you
]]>There is a fatal error on trying to retrieve customer license keys from the orders with non-existing products.
File plugins/license-manager-for-woocommerce/includes/Integrations/WooCommerce/Controller.php
Method getCustomerLicenseKeys
Potential fix: check if product exists before using its method get_meta.
/** @var WC_Product_Simple|WC_Product_Variation $product */
$product = $item_data->get_product();
// Check if the product has been activated for selling.
if (!$product || !$product->get_meta( 'lmfwc_licensed_product', true)) {
continue;
}
Please fix it or tell me how to avoid the error.
]]>Currently the plugin sends the codes automatically when the order is processed. The problem I have is that I have installed a payment gateway with high risk of fraud, I would like this particular gateway to send the codes when I verify and complete the order and not when it is processed. any ideas on how to fix this?
I thought about modifying the gateway plugin better so that it does not send the orders to processing but to another custom state, but there is no documentation nor did I get an answer.
]]>Hello,
This has been a great plugin. Thank you.
We would like to disable the key on the confirmation page for the DEMO version of our product. By showing the key, users can use fake email addresses and continue downloading the product after the Demo expires.
What part of the plugin needs to be edited, and how-so? CSS removal is not secure enough.
Thank you
]]>Hello everyone,
I��m trying to change the location of the ��Your Licence Keys�� element on the thank you page.
So the current structure of that page is
1. Order Details
2. Licence Keys
3. Invoice Details
Is there a way of placing the licence keys element before or after the other elements?
Thank you!
]]>Hey!
I bought premium License Manager, but i cant activate it, fatal error. I have installed free version.
]]>Hello,
I checked this plugin. someone users enable the premium version by the license key. Any user could not break the premium option may i feel the security using this plugin ?
]]>I have 2 issues that need experts to help me with.
After installing this plugin everything works fine but i have this message and i cannot see any order details in woocommerce:
WordPress w wersji 5.3.18
Aktualny motyw: Hair & Beauty (wersja 9)
Aktualna wtyczka: License Manager for WooCommerce (wersja 3.0.8)
Wersja PHP: 7.3.33
Szczeg��?y b??du
===================
B??d typu E_ERROR zosta? spowodowany w linii 296 pliku
/home/server127153/ftp/wp-content/plugins/license-manager-for-woocommerce/includes/Integrations/WooCommerce/Order.php.
Komunikat b??du: Uncaught ArgumentCountError: Too few arguments to
function LicenseManagerForWooCommerce\Integrations\WooCommerce\Order::addSendLicenseKeysAction(),
1 passed in /home/server127153/ftp/wp-includes/class-wp-hook.php on
line 288 and exactly 2 expected in
/home/server127153/ftp/wp-content/plugins/license-manager-for-woocommerce/includes/Integrations/WooCommerce/Order.php:296
Stack trace:
#0 /home/server127153/ftp/wp-includes/class-wp-hook.php(288):
LicenseManagerForWooCommerce\Integrations\WooCommerce\Order->addSendLicenseKeysAction(Array)
#1 /home/server127153/ftp/wp-includes/plugin.php(206):
WP_Hook->apply_filters(Array, Array)
#2 /home/server127153/ftp/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php(40):
apply_filters('woocommerce_ord...', Array)
#3 /home/server127153/ftp/wp-admin/includes/template.php(1343):
WC_Meta_Box_Order_Actions::output(Object(WP_Post), Array)
#4 /home/server127153/ftp/wp-admin/edit-form-advanced.php(670):
do_meta_boxes(Object(WP_Screen), 'side
]]>
Hi team, the license sent by email is displayed with this html formatting error.
]]>Hello team,
We have been using your plugin for a while and are very happy with the features and the overall quality! We do have a question, regarding the compatibility with the plugin WooCommerce Subscriptions (https://woocommerce.com/products/woocommerce-subscriptions/).
The issue we are facing, is that a subscription product in WooCommerce can be assigned a license key upon purchase, but each time the subscription is renewed (e.g. monthly payment), a new license key is issued.
Is there a way to limit the license key distribution to only the initial purchase, so we don’t issue a new license key when the subscription renews?
Thank you in advance!
]]>Queria compartir mi felicidad! sin saber programar le pedi a chatgpt que trabajaramos juntos en crear un shortcode para mostrar la licencia comprada donde yo quisiera. Despues de 40min ofreciendole la documentacion del plugin y los mensajes de aqui del foro de gente que buscaba lo mismo, consegui el cometido.
El shortcode a usar es [mostrar_licencias] y el codigo que deben a?adir al functions.php de su theme de wordpress es el siguiente:
use LicenseManagerForWooCommerce\Repositories\Resources\License as LicenseResourceRepository;
function mostrar_licencias_shortcode() {
if (!is_user_logged_in()) {
return '<p>Necesitas estar logueado para ver tus licencias.</p>';
}
$user_id = get_current_user_id();
$customer_orders = wc_get_orders(array(
'customer' => $user_id,
'status' => 'completed'
));
if (empty($customer_orders)) {
return '<p>No has comprado ninguna licencia.</p>';
}
ob_start(); // Iniciar el buffer de salida
echo '<h2>Cuentas Adquiridas</h2>';
foreach ($customer_orders as $order) {
$order_id = $order->get_id();
$items = $order->get_items();
foreach ($items as $item) {
$product_id = $item->get_product_id();
$product_name = $item->get_name();
$licenses = LicenseResourceRepository::instance()->findAllBy(array(
'order_id' => $order_id,
'product_id' => $product_id
));
if (!$licenses) {
continue;
}
echo '<table class="shop_table">';
echo '<thead><tr><th colspan="2">' . esc_html($product_name) . '</th></tr></thead>';
echo '<tbody>';
foreach ($licenses as $license) {
$decrypted_key = $license->getDecryptedLicenseKey();
$expires_at = $license->getExpiresAt();
echo '<tr>';
echo '<td colspan="' . ($expires_at ? '1' : '2') . '">';
echo '<span class="lmfwc-myaccount-license-key">' . esc_html($decrypted_key) . '</span>';
echo '</td>';
if ($expires_at) {
try {
$date = wp_date(get_option('date_format'), strtotime($expires_at));
} catch (Exception $e) {
$date = '';
}
$valid_until = 'V��lido hasta'; // Traducci��n de "Valid until"
echo '<td><span class="lmfwc-myaccount-license-key">' . sprintf('%s <strong>%s</strong>', esc_html($valid_until), esc_html($date)) . '</span></td>';
}
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
}
}
return ob_get_clean(); // Devolver el contenido del buffer de salida
}
add_shortcode('mostrar_licencias', 'mostrar_licencias_shortcode');
La web donde la estoy usando es en https://serienautas.com/
]]>First of all thank you for this monster plugin which is awesome, thank you very much.
I want to display the license purchased by the user in a different section. Before I had the WC SERIALKEY NUMBERS plugin and with chatgpt I had managed to create a shortcode where I placed it and displayed the license but with this plugin it became impossible.
I need if someone knows about the subject can throw me some basic information on how to display the license where I want. Something I can tell chatgpt to help me. I am not an expert in programming, but I have some knowledge and I am desperate to know that it has no function to show this license in another sector.
Is there anything I need to know?
Translated with DeepL.com (free version)
]]>Hi, does anyone have any recommendations on how to import multiple license keys via CSV with user info such as email, max activation count, number of activations used etc? The standard Import option seems entirely basic and unable to cope with these extra data points.
]]>Hi,
After update Woocommerce to 9.0 I have this error and generated codes not working. On version 8.52 of Woocommerce have not this error.
license-manager-for-woocommerce/vendor/composer/ClassLoader.php on line 576
After updating WordPress, Wordfence removed this plugin for security reason.
The Plugin “License Manager for WooCommerce” has been removed from www.remarpro.com but is still installed on your site.
Type: Plugin Removed
Issue Found 26 June 2024 05:32
Critical
Plugin Name: License Manager for WooCommerce Current Plugin Version: 3.0.7 Details: It has unpatched security issues and may have compatibility problems with the current version of WordPress. Get more information.
Is there a fixe ?
]]>you deleted license manager. what will happen next? why have you done this?
what will all sellers do now?
how come you suddenly delete a wide used code without asking millions of sellers?
this is wrong Woocommerce-Wordpress!
]]>Please add the ability to invoke an external key generator, and add support for multi line keys.
The generator should be callable by URL with placeholders for the generator name, amount of bought licenses if multiple of the same type ware bought as well as for the other customizable parameters.
The use case here not to use the plugins facilities for activation, deactivation and license validation, but just deploy externally generated license data which would be handles by other 3rd party mechanisms in the licensed software.
I have a ugly fork that does that partially based on an old plugin version so i can post it if there is interest.
]]>I would need the ability to get all keys generated for a given order-id, i have forked an older version to do that would be really great if you could add it to the official distribution.
includes\api\v2\Licenses.php
/**
* GET licenses/by-order/{order_id}
*
* Retrieves a single licenses from the database.
*/
register_rest_route(
$this->namespace, $this->rest_base . '/by-order/(?P<order_id>[\w-]+)', array(
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array($this, 'getLicensesByOrder'),
'permission_callback' => array($this, 'permissionCallback'),
'args' => array(
'order_id' => array(
'description' => 'Order ID',
'type' => 'integer',
)
)
)
)
);
and
public function getLicensesByOrder(WP_REST_Request $request)
{
if (!$this->isRouteEnabled($this->settings, '010')) {
return $this->routeDisabledError();
}
if (!$this->permissionCheck('license', 'read')) {
return new WP_Error(
'lmfwc_rest_cannot_view',
__('Sorry, you cannot list resources.', 'license-manager-for-woocommerce'),
array(
'status' => $this->authorizationRequiredCode()
)
);
}
$orderId = absint($request->get_param('order_id'));
if (!$orderId) {
return new WP_Error(
'lmfwc_rest_data_error',
'Order ID invalid.',
array('status' => 404)
);
}
try {
/** @var LicenseResourceModel[] $licenses */
$licenses = LicenseResourceRepository::instance()->findAllBy(
array(
'order_id' => $orderId
)
);
} catch (Exception $e) {
return new WP_Error(
'lmfwc_rest_data_error',
$e->getMessage(),
array('status' => 404)
);
}
if (!$licenses) {
return new WP_Error(
'lmfwc_rest_data_error',
'No License Keys available',
array('status' => 404)
);
}
$response = array();
/** @var LicenseResourceModel $license */
foreach ($licenses as $license) {
$licenseData = $license->toArray();
// Remove the hash, decrypt the license key, and add it to the response
unset($licenseData['hash']);
$licenseData['licenseKey'] = $license->getDecryptedLicenseKey();
$response[] = $licenseData;
}
return $this->response(true, $response, 200, 'v2/licenses/by-order');
}
]]>
Hello,
I want the license data after a successful order to be sent to Google Sheet through Google App Script and Webhook, but the data is not sent to the sheet for me. Help me
Is there any way that I can see which site is using my product license?
]]>I want to emphasize that the complement is very good, they have done a great job.
Currently, I have the following problem and I would like to know if anyone else has had it and how they solved it.
Our store is located in Colombia and when we receive orders from South America the codes are sent automatically without problems; however, when we receive orders from Asia or Europe they are almost never sent automatically and we have to do it manually. I have identified that the problem definitely occurs when the customer is in a distant country. For other reasons I had to change the server from USA to Brazil and the problem got even worse.
How can I solve this problem?
]]>After the last update, when I have a valid license key e.g. ID-03y8XR5KKlwum5g and send the usual authenticated post to https://127.0.0.1/shop/wp-json/lmfwc/v2/licenses/validate/ID-03y8XR5KKlwum5g
I now get a http 500 response code with
<!--
ErrorException: Undefined variable $activation_data in file C:\projekte\homepages\shop\wp-content\plugins\license-manager-for-woocommerce\includes\Api\V2\Licenses.php on line 885
in it’s body. If in \includes\Api\V2\Licenses.php in l. 877 I add
$activation_data =[];
it works again.
]]>We just switched from another licensing plugin (they shutdown the business and plugin is no longer being maintained)
The listed libraries on the documentation are pretty much outdated and none of them seems to be working, can you provide us with an updated library to integrate the license activation/deactivation into our themes?
]]>Hello i just installed the plugin, my keys are set correctly but when an order is made the client is not receiving his key and i don’t see any change in my license keys stock.
Of course i want to auto deliver the serial key only after the user payment.
Can you help me please ?
Here are my settings
https://ibb.co/mSKSZ3V
https://ibb.co/hgLdwg6
https://ibb.co/ykXSyf3
https://ibb.co/hdSBc4s
https://ibb.co/6HnCK4Q
Hello,
I use the REST API to get license info, using the v2/licenses/{license_key} endpoint. I want to filter the response data so I found the lmfwc_rest_api_pre_response filter.
There are 2 problems:
I would be grateful if you could fix at least the main problem (1) which the wrong arguments order. This is a fairly simple fix, is it possible that you can make it happen any time soon?
Thank you
]]>Hi all, I��m getting a Uncaught Error when trying to retrieve a licence with non-existing license number, Internal Server Error. However, when I try to do the same with “activate” call, response is correct and JSON message is sent back normally with message about non-existing license key.
What can be wrong? I��ve tested it in Postman, just for testing purposes. It should be bulletproof, consumer may type the wrong license key, taht is a normal thing.
]]>