Title: WooCommerce REST API using deprecated code
Last modified: June 28, 2023

---

# WooCommerce REST API using deprecated code

 *  Resolved [KevinPlusPlus](https://wordpress.org/support/users/kevinplusplus/)
 * (@kevinplusplus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/woocommerce-rest-api-using-deprecated-code/)
 * Built-in WooCommerce REST API code is using a deprecated accessor and needs to
   be updated.
 * In /woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-
   controller.php
 * Around like 324, change FROM:
 *     ```wp-block-code
       				'code'         => $coupon_item['name'],
       				'discount'     => wc_format_decimal( $coupon_item['discount_amount'], $dp ),
       				'discount_tax' => wc_format_decimal( $coupon_item['discount_amount_tax'], $dp ),
       ```
   
 * Change TO:
 *     ```wp-block-code
       				'code'         => $coupon_item->get_name(),
       				'discount'     => wc_format_decimal( $coupon_item->get_discount(), $dp ),
       				'discount_tax' => wc_format_decimal( $coupon_item->get_discount_tax(), $dp ),
       ```
   
 * The name, discount amount, and discount amount tax should not be accessed using
   the array parameters, but rather with getters.
 * This will remove the deprecation warning when accessing coupon information in
   REST API v1.
 * Thank you!
 * Kevin

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

 *  Thread Starter [KevinPlusPlus](https://wordpress.org/support/users/kevinplusplus/)
 * (@kevinplusplus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/woocommerce-rest-api-using-deprecated-code/#post-16855755)
 * Bug report also submitted on Github #**39006**
 *  Plugin Support [Andrew DS a11n](https://wordpress.org/support/users/druesome/)
 * (@druesome)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/woocommerce-rest-api-using-deprecated-code/#post-16865656)
 * Thanks for filing the bug report! Let’s continue to track its progress via [Github](https://github.com/woocommerce/woocommerce/issues/39006),
   so I’ll go ahead and close this up.

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

The topic ‘WooCommerce REST API using deprecated code’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [Andrew DS a11n](https://wordpress.org/support/users/druesome/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/woocommerce-rest-api-using-deprecated-code/#post-16865656)
 * Status: resolved