• Resolved kartiksadadiya

    (@kartiksadadiya)


    I am getting this error when try to update the order from admin

    Uncaught Error: Call to a member function get_price() on null
    in /public_html/wp-content/plugins/wt-smart-coupons-for-woocommerce/public/modules/bogo/bogo.php on line 1689

    Call stack:

    Wbte_Smart_Coupon_Bogo_Public::exclude_giveaway_from_other_discounts()
    wp-includes/class-wp-hook.php:324
    WP_Hook::apply_filters()
    wp-includes/plugin.php:205
    apply_filters()
    wp-content/plugins/woocommerce/includes/class-wc-coupon.php:931
    WC_Coupon::is_valid_for_product()
    wp-content/plugins/woocommerce/includes/class-wc-discounts.php:332
    WC_Discounts::get_items_to_apply_coupon()
    wp-content/plugins/woocommerce/includes/class-wc-discounts.php:265
    WC_Discounts::apply_coupon()
    wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1439
    WC_Abstract_Order::recalculate_coupons()
    wp-content/plugins/woocommerce/includes/admin/wc-admin-functions.php:460
    wc_save_order_items()
    wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-items.php:53
    WC_Meta_Box_Order_Items::save()
    wp-includes/class-wp-hook.php:326
    WP_Hook::apply_filters()
    wp-includes/class-wp-hook.php:348
    WP_Hook::do_action()
    wp-includes/plugin.php:517
    do_action()
    wp-content/plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php:262
    WC_Admin_Meta_Boxes::save_meta_boxes()
    wp-includes/class-wp-hook.php:326
    WP_Hook::apply_filters()
    wp-includes/class-wp-hook.php:348
    WP_Hook::do_action()
    wp-includes/plugin.php:517
    do_action()
    wp-includes/post.php:5110
    wp_insert_post()
    wp-includes/post.php:5212
    wp_update_post()
    wp-admin/includes/post.php:453
    edit_post()
    wp-admin/post.php:227

    The scenario is when user tried do the payment and it failed due to payment gateway issue in that case order fall in to the failed order, Now I want to manually change the status of the order from fail to processing but when I try to do so I get this error.

    Temporary I have add this solution but not sure if it will perfect and not affect other areas

    public static function exclude_giveaway_from_other_discounts( $valid, $product, $coupon, $values ) {

    /*
    // disabled this code
    if ( self::is_a_free_item( $values ) && 0 >= $values['data']->get_price() ) {
    return false;
    }
    */

    // Added this code
    if ( self::is_a_free_item( $values )
    && isset( $values['data'] )
    && is_object( $values['data'] )
    && method_exists( $values['data'], 'get_price' )
    && 0 >= $values['data']->get_price() ) {
    return false;
    }

    if ( self::is_bogo( $coupon->get_id() ) ) {
    return true;
    }

    return $valid;
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @kartiksadadiya,

    Thank you for sharing the error details and the temporary solution you’ve applied. To help us investigate further and ensure no other areas are affected, could you please share the following:

    1. A screenshot of the order edit page where the issue occurs.
    2. A copy of your site’s System Status Report (WooCommerce > Status > Get system report).

    You can securely upload these details via this link.

    Thread Starter kartiksadadiya

    (@kartiksadadiya)

    Here is the screenshot of the error – https://prnt.sc/TdVfgo0Ity3b Also I am not able to submit the request first I got this error – https://prnt.sc/YDh86PobXu5I then got this error on your website – https://prnt.sc/U16KF5ojieKd when copy and pasted the system report.

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @kartiksadadiya,

    Thank you for sharing the screenshot of the error and also for letting us know about the issue you faced while submitting the system report. I’ll check this further with our team and get back to you shortly with an update.

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @kartiksadadiya,

    Thanks for waiting. We wanted to let you know that the issue you experienced has been addressed in the latest release of the plugin.

    Could you please update to the newest version and check if the error no longer occurs when updating orders? If you still notice any problems after updating, feel free to share the details here and we’ll be glad to take another look.

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

The topic ‘Uncaught Error when update order’ is closed to new replies.