Uncaught Error when update order
-
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:227The 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)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Uncaught Error when update order’ is closed to new replies.