• Resolved damasovelazquez

    (@damasovelazquez)


    Hello,

    When I click on the ‘New subscription’ button, an error appears in the right-hand box of the plugin information and the following error message appears in the log.

    [25-Aug-2025 06:07:03 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get_total() on bool in /home/web01/public_html/wp-content/plugins/yith-woocommerce-affiliates/views/meta-boxes/referral-commissions-metabox.php:40
    Stack trace:
    #0 /home/web01/public_html/wp-content/plugins/yith-woocommerce-affiliates/includes/admin/meta-boxes/class-yith-wcaf-order-referral-commissions-meta-box.php(74): include()
    #1 /home/web01/public_html/wp-admin/includes/template.php(1456): YITH_WCAF_Order_Referral_Commissions_Meta_Box::print()
    #2 /home/web01/public_html/wp-admin/edit-form-advanced.php(714): do_meta_boxes()
    #3 /home/web01/public_html/wp-admin/post-new.php(75): require('/home/web01/...')
    #4 {main}
    thrown in /home/web01/public_html/wp-content/plugins/yith-woocommerce-affiliates/views/meta-boxes/referral-commissions-metabox.php on line 40

    Can you help me, please?

    Thank you.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Juan Coronel

    (@juaancmendez)

    Hello there,
    thanks for contacting us!

    Could you please tell us which version of Affiliates you’re using, and which Subscriptions plugin?

    Let us know.

    Best regards.

    Thread Starter damasovelazquez

    (@damasovelazquez)

    The last one: 3.20.0 

    Thank you.

    Thread Starter damasovelazquez

    (@damasovelazquez)

    And WooCommerce Subscriptions version is 7.8.1.

    Juan Coronel

    (@juaancmendez)

    Hello there,

    That plugin is paid, so I don’t have access to it. However, try adding the following code to your active theme’s functions.php file:

    if ( ! function_exists( 'yith_wcaf_commissions_metabox_order_total_fix' ) ) {
    function yith_wcaf_commissions_metabox_order_total_fix( $total, $order ) {
    $total = $order instanceof WC_Order ? $order->get_total() : 0;
    return $total;
    }
    add_filter( 'yith_wcaf_commissions_metabox_order_total', 'yith_wcaf_commissions_metabox_order_total_fix', 99, 2 );
    }

    Could you check it, please?

    Best regards.

    Thread Starter damasovelazquez

    (@damasovelazquez)

    Hello, thank you very much for reviewing this error. I have tried the code you sent me, but I am still getting the same error.

    Any ideas?

    Thank you very much.

    Juan Coronel

    (@juaancmendez)

    Hello there,

    Could you confirm for me that the first line of the error has the number 40 at the end like this?

    [25-Aug-2025 06:07:03 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get_total() on bool in /home/web01/public_html/wp-content/plugins/yith-woocommerce-affiliates/views/meta-boxes/referral-commissions-metabox.php:40

    Let us know.

    Best regards.

    Thread Starter damasovelazquez

    (@damasovelazquez)

    Yes. I confirm it..

    Hello there,

    Please in the line 40 of the following file:

    \wp-content\plugins\yith-woocommerce-affiliates\includes\admin\meta-boxes\class-yith-wcaf-order-referral-commissions-meta-box.php

    add the following code:

    if ( ! $order || ! $order instanceof WC_Order ) {
    return;
    }

    Could you check it, please?

    If it works correctly, we will include that change in the next version of the plugin.

    Best regards.

    Thread Starter damasovelazquez

    (@damasovelazquez)

    Solved, mate.

    I’m waiting for that new version.

    Thank you very much for your work.

    Hello there,
    you’re welcome!

    We’ve just added the change to the plugin, and it will be available in the next version (3.22.0).

    Best regards.

    Thread Starter damasovelazquez

    (@damasovelazquez)

    Thank you!

    Best regards.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Error on create new subscription’ is closed to new replies.