Title: How To Debug A Woocommerce Function?
Last modified: April 21, 2018

---

# How To Debug A Woocommerce Function?

 *  Resolved [ozanyilmaz2017](https://wordpress.org/support/users/ozanyilmaz2017/)
 * (@ozanyilmaz2017)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/how-to-debug-a-woocommerce-function/)
 * After updating woocommerce, “add_to_cart” inside “class-wc-cart.php” now returning
   false for my plugin.
 * Can you tell me a way to debug this? I am originally a .NET developer, and I 
   am novice on debugging the php. I changed WP_DEBUG to true, but it is not returning
   any errors or creating an error_log file. So how can I debug this function step
   by step and find the line which causes this function to return false?

Viewing 1 replies (of 1 total)

 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/how-to-debug-a-woocommerce-function/#post-10204321)
 * Insert temporary lines to write to the error log at key points in the function
   to ensure each line is doing what you think it should.
 *     ```
       // arrays and objects
       error_log( print_r( $log, true ) );
       // simple variables
       error_log( $log );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘How To Debug A Woocommerce Function?’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [debugging](https://wordpress.org/support/topic-tag/debugging/)

 * 1 reply
 * 2 participants
 * Last reply from: [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/how-to-debug-a-woocommerce-function/#post-10204321)
 * Status: resolved