Validation error on a second device for subscriptions - Woocommerce integration kit

was able to fix the subcontroller, stupid mistakes in there…
Should be:
if ($b) {
$order_data->update_meta_data(“xlspadlock_activations_$product_id”, $existing_activations_str);
$order_data->save_meta_data();
}

before, was: if (!$b)

However, since wp 6.3.0, there are many issues that need to be fixed,
$order_item->product_id fails, should be now:
$order_item->get_product_id()
And many similar changes

Yes, our WP engineer will release an updated kit for these breaking changes on this Monday. Thanks for the report!

Great! Will it possible for the user to deactivate the protected workbook and reactivate on a different device?
It should be a feature of the new version of xls padlock, right?

Yes, it’s in the next incoming version. There is a new Deactivation feature and we’ll also update the WooCommerce Integration Kit when it is available.
However, it’s not yet in the fix we’ll release on Monday.

correction:
if ($b) or if (!$b) is wrong, should not even be here, it’s wrong logic.
If true, it means that the custom field xlspadlock_activations_$product_id was found in order, the app will append a new system id to existing string, BUT will not create the custom field if does not exist!

If not true, means that the custom field does not exist, will be created with the first system id, BUT it will NOT append next validations.

There should be NO if statement at all, works as designed ONLY with:
$order_data->update_meta_data(“xlspadlock_activations_$product_id”, $existing_activations_str);
$order_data->save_meta_data();

I believe it never worked as intended, for orders with a quantity more than 1, and that is a shocking surprise.
Hope it helps.

Actually, the code itself is not erroneous.
The condition was here to create the meta field if it was not present. If it was, no need to create it again, we change its value only and after that we save the order, including meta data. It used to work before, but it seems it has changed somehow.
Anyway, this will be fixed on Monday.

In pseudo code, the logic was like this: if field does not exist, create it.
There was indeed a field update line:
if (“xlspadlock_activations_$product_id” == $meta_item->key) {
$meta_item->value = $existing_activations_str;
$b = true;
break;
}
The problem in this approach is that there is no save, order data is saved only on first activation, when the field doesn’t exist, meta_item->value is set, but not saved/updated to store order.
What should have been is maybe: if field exists, update it, else create it.

Tested many times, without any if statement the code works perfectly, the custom field is added only once on first activation and updated on next ones, no matter how many users activate the token.
Anyway, works fine now, these are my first php lines I ever wrote, never coded in php before.

Can you tell us an approximate date for the release of new version of xls padlock?
Thanks

Next release of XLS Padlock will be published on next week. Thank you.

Ok, thanks for the update.