Title: Error
Last modified: March 25, 2021

---

# Error

 *  [Matt Rose](https://wordpress.org/support/users/boswall/)
 * (@boswall)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/error-1504/)
 * Looks like this has happened to a couple of other users before but I’m very occasionally
   getting the following error:
 *     ```
       2021-03-25T15:05:55+00:00 CRITICAL Uncaught Error: Cannot use object of type WP_Error as array in /public_html/wp-content/plugins/referralcandy-for-woocommerce/includes/class-rc-order.php:149
       Stack trace:
       #0 /public_html/wp-content/plugins/referralcandy-for-woocommerce/includes/class-wc-referralcandy-integration.php(209): RC_Order->submit_purchase()
       #1 /public_html/wp/wp-includes/class-wp-hook.php(294): WC_Referralcandy_Integration->rc_submit_purchase(70991)
       #2 /public_html/wp/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
       #3 /public_html/wp/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
       #4 /public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(363): do_action('woocommerce_ord...', 70991, Object(Automattic\WooCommerce\Admin\Overrides\Order))
       #5 /public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(221): WC_Order->status_trans in /home/goodlifecompetit/public_html/wp-content/plugins/referralcandy-for-woocommerce/includes/class-rc-order.php on line 149
       ```
   
 * Looking at the code, it seems like you need to check if the $response is not 
   a WP_Error before #L149. Something like:
 *     ```
       if ( is_wp_error( $response ) ) {
         return;
       }
       ```
   
    -  This topic was modified 5 years, 2 months ago by [Matt Rose](https://wordpress.org/support/users/boswall/).
    -  This topic was modified 5 years, 2 months ago by [Matt Rose](https://wordpress.org/support/users/boswall/).

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

 *  [CSE Jason](https://wordpress.org/support/users/jasonnrc/)
 * (@jasonnrc)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/error-1504/#post-14265610)
 * Hello [@boswall](https://wordpress.org/support/users/boswall/) ,
 * Apologies for the delay in response, and thank you for raising this. Our team
   is currently working on another update now, but we’ll include the fix for this
   issue on the next release.
 * Thanks again!
 *  [jaredhill4](https://wordpress.org/support/users/jaredhill4/)
 * (@jaredhill4)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-1504/#post-14593457)
 * I’m experiencing the same issue, which is preventing some of our WooCommerce 
   subscriptions from auto-renewing properly.
 * Any ideas when the plugin might be updated to account for this bug?
 * Also any idea why the API would be throwing an error?
 *     ```
       06-23-2021 @ 01:34:41 - scheduled action 941111 (subscription payment) failed to finish processing due to the following error: Uncaught Error: Cannot use object of type WP_Error as array in /nas/content/live/nybll/wp-content/plugins/referralcandy-for-woocommerce/includes/class-rc-order.php:149
       Stack trace:
       #0 /nas/content/live/nybll/wp-content/plugins/referralcandy-for-woocommerce/includes/class-wc-referralcandy-integration.php(209): RC_Order->submit_purchase()
       #1 /nas/content/live/nybll/wp-includes/class-wp-hook.php(294): WC_Referralcandy_Integration->rc_submit_purchase(75387)
       #2 /nas/content/live/nybll/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
       #3 /nas/content/live/nybll/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
       #4 /nas/content/live/nybll/wp-content/plugins/woocommerce/includes/class-wc-order.php(363): do_action('woocommerce_ord...', 75387, Object(WC_Order))
       #5 /nas/content/live/nybll/wp-content/plugins/woocommerce/includes/class-wc-order.php(221): WC_Order->status_transition()
       #6 /nas/content/live/nybll/wp-content/plugins/woocommerce/includes/class-wc-order.php(119): WC_Order->save()
       ```
   
 *  [jaredhill4](https://wordpress.org/support/users/jaredhill4/)
 * (@jaredhill4)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-1504/#post-14593695)
 * [@jasonnrc](https://wordpress.org/support/users/jasonnrc/),
 * I just updated to the latest version (I was on v2.3.0), and it looks like the
   fix did NOT make it into the most recent releases (v2.3.1 or v2.3.2).
 * Any idea when this will be fixed? For now, I’m going to fork the plugin code 
   and just add the fix myself.
 *  [jaredhill4](https://wordpress.org/support/users/jaredhill4/)
 * (@jaredhill4)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-1504/#post-14593803)
 * [@jasonnrc](https://wordpress.org/support/users/jasonnrc/),
 * I went ahead and create a pull request with the fix here:
 * [https://github.com/ReferralCandy/woocommerce-referralcandy/pull/40](https://github.com/ReferralCandy/woocommerce-referralcandy/pull/40)

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

The topic ‘Error’ is closed to new replies.

 * ![](https://ps.w.org/referralcandy-for-woocommerce/assets/icon-128x128.png?rev
   =3475696)
 * [ReferralCandy for WooCommerce – Advanced Referral & Affiliate Program](https://wordpress.org/plugins/referralcandy-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/referralcandy-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/referralcandy-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/referralcandy-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/referralcandy-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/referralcandy-for-woocommerce/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [jaredhill4](https://wordpress.org/support/users/jaredhill4/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/error-1504/#post-14593803)
 * Status: not resolved