• Resolved rosen4o

    (@rosen4o)


    Hello,

    I’m using your Custom Order Numbers for WooCommerce plugin
    But I have very interesting problem
    I have plugin which is handling payments and at some point plugin is calling

    $order->update_status( ‘on-hold’, “Payment NOT confirmed response:” );

    Which trow this error

    Fatal error: Uncaught Error: Call to a member function update_status() on boolean

    When plugin is disabled everything is working normally.
    Any idea how to fix the issue

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @rosen4o,

    Can you please provide us the plugin which you are using for payments on your site?

    This would help us to replicate the issue on our staging site and then we can assist you in a better way.

    Regards,
    Komal Maru

    Thread Starter rosen4o

    (@rosen4o)

    It’s standard payment plugin which get order like this

    /**
    			 * get_borica_order function.
    			 *
    			 * @param  string $custom
    			 * @param  string $invoice
    			 * @return WC_Order object
    			 */
    			 public function get_borica_order( $order_id ) {
    					
    					$order = wc_get_order( $order_id );
    			
    					if ( ! isset( $order->id ) ) {
    						global $wpdb;
    
    					    // Faster than get_posts()
    					    $order_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->prefix}postmeta WHERE meta_key = '_order_number' AND meta_value = %s", (int)$order_id ) );
    		
    					    $order 		= wc_get_order( $order_id );
    					}
    					return $order;
    			 }

    And later I’m using with object from above.
    $order->update_status( 'on-hold', "Payment NOT confirmed")

    Will check which function should be used

    Hi @rosen4o,

    Thank you for sharing the custom code which you are using on your site.

    Can you please provide us the hook on which this function ‘get_borica_order’ has been attached to?

    This information would help us to check whether we are using the hook in our plugin which is conflicting it with your code.

    Also, please let me know whether deactivating our Custom Order Numbers for WooCommerce plugin, the fatal error is not coming on your site?

    Regards,
    Komal Maru

    Thread Starter rosen4o

    (@rosen4o)

    Yes I can confirm that if I disable Custom Order number plugin error is disappearing.
    The code is executed in external file like this

    <?php
    
    if (!function_exists('add_action')){
    		require_once("../../../wp-load.php");
    }
    
    if(!session_id()) {
            session_start();
    }
    
    $borica = new WC_Gateway_BORICA;
    
    $order = $borica->get_borica_order( 111 );
    

    Hi @rosen4o,

    Thank you for debugging the issue on your site by deactivating our plugin.

    It would be great if you can send the admin and the FTP credentials of your staging site (if any) via email where we can debug the issue.

    Please email us at ‘support at tychesoftwares dot freshdesk dot com’ email id.

    Regards,
    Komal Maru

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problem with payment plugin’ is closed to new replies.