• Resolved Sara Die Webmacherin

    (@larvafashion)


    Hello WP Loyalty team,

    We are using you plugin in an Austrian shop that also includes a label creation plugin from the Austrian post office.

    When WP Loyalty is active we cannot finish orders with bulk edit (processing to completed, other status changes work fine), and get an error from the label creation plugin. But since it works fine without WP Loyalty this is a conflict and not an error in the label creation plugin.

    Here is the error: Uncaught Error: Call to a member function get_id() on null in /website.at/wp-content/plugins/wc-plc/admin/class-wc-plc-admin.php:247

    Here you can find the label creation plugin: https://www.post.at/g/c/post-labelcenter-plug-in

    Should WP Loyalty even interfere in admin bulk editing? Maybe just when orders are completed (to award points or something similar)? Any idea how we can narrow down on the source of the conflict?

    Edit: It also happens when finishing single orders. So anytime the status changes to completed for the first time.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support akshayathangaraj

    (@akshayathangaraj)

    Hello,

    Thank you for reaching out to us.

    We have reviewed the issue you’re experiencing when changing the order status to “Completed” with WP Loyalty active. You are correct — WP Loyalty triggers actions (like awarding points and sending email notifications for points earned) when the status changes to “Completed.”

    However, after examining the error you’re encountering, it seems the conflict is related to the label creation plugin’s handling of the order object. Both WP Loyalty and the label plugin use the same hook during this status change.

    $this->loader->add_filter( 'woocommerce_email_format_string', $plugin_admin, 'plc_tracking_links_placeholder', 99, 2 );

    In this case, the label creation plugin attempts to process the order object, but it does so without validating whether the object exists or is of the correct type.

    Specifically, the error occurs in this part of their code:

    $order = $email->object;

    In the callback function plc_tracking_links_placeholder, the code attempts to fetch the order object directly:

    public function plc_tracking_links_placeholder( $string, $email ) {

    $placeholder = '{tracking_numbers}';

    $order = $email->object;

    $value = $this->plc_get_tracking_numbers( $order );

    return str_replace( $placeholder, $value, $string );

    }

    In this instance, $order might be null (as it’s not always the order object that gets passed), which leads to the error. In some cases, it could be a user object or another type(based on the plugin requirement), which leads to the order being null. The plugin should ideally include validation to check if the order object exists before processing it.

    Additionally, in the plc_get_tracking_numbers function, the order object is used without validation:

    public function plc_get_tracking_numbers( $order ) {

    global $wpdb;

    $query = '

    SELECT * FROM ' . PLC_SHIPMENTS . '

    WHERE order_id="' . $order->get_id() . '"

    ';

    $results = $wpdb->get_results( $query, OBJECT );

    .......

    }

    If the $order is null, calling $order->get_id() will result in an error. It’s crucial to validate the order object to prevent these issues from occurring.

    We recommend reaching out to the label creation plugin’s support team and pointing out this issue. They may need to implement validation for the order object before using it in their callbacks.

    Please let us know if you need further assistance or clarification. We’re here to help!

    Best regards,

    Akshaya

    Flycart Support Team

    Thread Starter Sara Die Webmacherin

    (@larvafashion)

    Hello Akshaya,

    Thank you very much for the detailed analysis. I will inform the plugin developer.

    Plugin Support akshayathangaraj

    (@akshayathangaraj)

    You are most welcome ??
    Feel free to reach out in case of any further queries.
    We would be glad to assist you.
    ?
    Good Day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.