Notice: Trying to get property of non-object in commerce_license_commerce_order_update() (line 409 of commerce_license.module). =>

Created on 18 December 2017, over 7 years ago
Updated 19 August 2025, 4 days ago

We need to delete orders on certain conditions with "Delete entity" rule. For example, when removing a product from cart. Unfortunately, when deleting an order with "Delete entity" rule it gives an error:

Notice: Trying to get property of non-object in commerce_license_commerce_order_update() (line 410 of /home/username/public_html/sites/all/modules/commerce_license/commerce_license.module). =>

The Rules' log show the rule "Charge a recurring order" is failing:

0 ms Reacting on event After updating an existing commerce order.
0.068 ms Evaluating conditions of rule Charge a recurring order. [edit]
0.42 ms Unable to get a data value. Error: Invalid data value given. Be sure it matches the required data type and format. Value at commerce_order(): .
0.606 ms Unable to evaluate condition data_is. [edit]
0.614 ms AND evaluated to FALSE.
0.619 ms Finished reacting on event After updating an existing commerce order.

which unfortunately always trigger AFTER our custom rule to delete the order entity even though we assigned the heaviest weight 10 in its settings.

I am not sure how to troubleshoot this further, but the line 410 looks like:

  if ($order->status != $order->original->status && $order->status == 'canceled') {
    foreach ($licenses as $license) {
      $license->revoke();
    }
  }

and I believe it does not take into account cases when orders get completely deleted and not only change their status.

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024