Title: Rest API Order ID
Last modified: August 11, 2022

---

# Rest API Order ID

 *  Resolved [dabeecher](https://wordpress.org/support/users/dabeecher/)
 * (@dabeecher)
 * [4 years ago](https://wordpress.org/support/topic/rest-api-order-id/)
 * Hello,
 * I have modified my order ID’s to include a reference before hand. All order id’s
   start with “DC22-“.
 * When I hit the REST API, the ID is still the integer version so stripping out
   the DC22, which when pushing to my CRM it’s incorrect.
 * Is there a way to change the ID value in the REST API response?

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

 *  Plugin Support [Sandip Mondal – a11n](https://wordpress.org/support/users/sandipmondal/)
 * (@sandipmondal)
 * [4 years ago](https://wordpress.org/support/topic/rest-api-order-id/#post-15909976)
 * Hi [@dabeecher](https://wordpress.org/support/users/dabeecher/),
 * >  I have modified my order ID’s to include a reference before hand. All order
   > id’s start with “DC22-“.
 * Can you please let us know how you’ve modified the order IDs to include the prefix`
   DC22-`? Did you achieve this with the help of a plugin?
 * >  When I hit the REST API, the ID is still the integer version so stripping 
   > out the DC22, which when pushing to my CRM it’s incorrect.
   > Is there a way to change the ID value in the REST API response?
 * The API response will send back the `post_ID` values which are stored in the 
   database for the corresponding orders.
 * If you’ve added the prefix using a plugin or custom code – then it only changed
   the order IDs in the database but the `post_id` is still intact.
 * I’d recommend you do not make any changes in the `post_id` since that can lead
   to other issues.
 * If it’s possible, please add the prefix `DC22-` using custom code for your use
   case after you’ve received the response from the API.
    -  This reply was modified 4 years ago by [Sandip Mondal - a11n](https://wordpress.org/support/users/sandipmondal/).
    -  This reply was modified 4 years ago by [Sandip Mondal - a11n](https://wordpress.org/support/users/sandipmondal/).
 *  Thread Starter [dabeecher](https://wordpress.org/support/users/dabeecher/)
 * (@dabeecher)
 * [4 years ago](https://wordpress.org/support/topic/rest-api-order-id/#post-15910310)
 * Hi Sandip,
 * I have just used a hook to create the new order id
 *     ```
       # ===========  ADD PREFIX TO ORDER ID =========== #
       function change_woocommerce_order_number( $order_id ) {
           $prefix = 'DC22-';
           $new_order_id = $prefix . $order_id;
           return $new_order_id;
       }
       add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' );
       ```
   
 * I don’t want to actually change the post_id, but in the REST API response, is
   there a way to modify “ID”.
 * Basically the CRM I am pushing to can’t change the field they are looking at,
   so it has to be ID. So I want to modify the response of ID in the orders REST
   API response
 *  Plugin Support [Sandip Mondal – a11n](https://wordpress.org/support/users/sandipmondal/)
 * (@sandipmondal)
 * [4 years ago](https://wordpress.org/support/topic/rest-api-order-id/#post-15915992)
 * Hey [@dabeecher](https://wordpress.org/support/users/dabeecher/),
 * Thanks for getting back!
 * Using the code you’ve shared – I see it will only update the “order number” and
   it won’t change the “post id” of the order.
 * > I don’t want to actually change the post_id, but in the REST API response, 
   > is there a way to modify “ID”.
 * There isn’t a way to modify the REST API response so you can modify the “ID” 
   itself.
 * When you make a request to the API, it will return the “post ID” and the “order
   number” along with other details you can see here: [https://d.pr/i/kNFRow](https://d.pr/i/kNFRow)
 * So, I’d recommend you look for options such that you can map the CRM to the “
   order number” field (as seen in the screenshot above) since it is updated per
   your goal.
 * I’ll also advise you to reach out to the CRM platform and check if they have 
   any in-built solutions for WooCommerce Integration. Also, can you please share
   the name of the CRM platform you are trying to integrate this with?
 * Thanks! 🙂

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

The topic ‘Rest API Order ID’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3640790)
 * [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/)

 * 3 replies
 * 2 participants
 * Last reply from: [Sandip Mondal – a11n](https://wordpress.org/support/users/sandipmondal/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/rest-api-order-id/#post-15915992)
 * Status: resolved