Title: Adding code to success page
Last modified: August 30, 2023

---

# Adding code to success page

 *  Resolved [ArtistScope](https://wordpress.org/support/users/artistscope/)
 * (@artistscope)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/adding-code-to-success-page/)
 * I need to provide some code for our client to add to his success page that will
   send some data to our server to create a DRM token. I have installed WooCommerce
   for WordPress and it looks like line #65 on /templates/order/order-details.php
   may be useful.
 * What I need is the data pertinent to the transaction:
    - invoice id
    - item id
    - item name
    - item description
 * Can I use $order, $item_id, $item, $product in our code that we add to send those
   details? If not what do you recommend?

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

 *  Thread Starter [ArtistScope](https://wordpress.org/support/users/artistscope/)
 * (@artistscope)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/adding-code-to-success-page/#post-17019595)
 * What I need is a list of the variables that can be retrieved from the thanks/
   receipt page. For example:
 * $invoiceid = WP invoice number
   $itemid = product id$itemname = Title of the productetc
    -  This reply was modified 2 years, 9 months ago by [ArtistScope](https://wordpress.org/support/users/artistscope/).
 *  [Saif](https://wordpress.org/support/users/babylon1999/)
 * (@babylon1999)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/adding-code-to-success-page/#post-17028626)
 * Hello [@artistscope](https://wordpress.org/support/users/artistscope/),
   Thank
   you for reaching out!
 * > I need to provide some code for our client to add to his success page that 
   > will send some data to our server to create a DRM token. I have installed WooCommerce
   > for WordPress and it looks like line #65 on /templates/order/order-details.
   > php may be useful.
 * Just to make sure we’re on the same page, you’re trying to send the order data
   to your server when someone lands on the “order-received” page, correct?
   It might
   be easier to achieve this with the built-in WooCommerce order.received webhook.
   It will send all the order data to a delivery URL of your choice in JSON. For
   more context, please check [https://woocommerce.com/document/webhooks/](https://woocommerce.com/document/webhooks/).
   You can use [webhook.site](https://webhook.site/) to easily test the payload 
   before configuring your own server.
 * Let us know if you have any other questions.
 *  Thread Starter [ArtistScope](https://wordpress.org/support/users/artistscope/)
 * (@artistscope)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/adding-code-to-success-page/#post-17028667)
 * Thanks for your reply. Woo support team sent me a link that has been most useful…
   [https://wpdavies.dev/how-to-get-all-product-info-in-woocommerce/](https://wpdavies.dev/how-to-get-all-product-info-in-woocommerce/)
 *  [hrn1995 (woo-hc)](https://wordpress.org/support/users/aguinaldodarla/)
 * (@aguinaldodarla)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/adding-code-to-success-page/#post-17030683)
 * Hi [@artistscope](https://wordpress.org/support/users/artistscope/)
 * That’s good to know! Please don’t hesitate to [start a new topic](https://wordpress.org/support/theme/storefront/#new-topic-0)
   if you have any more questions down the line.
 * Have a fantastic day!

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

The topic ‘Adding code to success page’ 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

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

 * 4 replies
 * 3 participants
 * Last reply from: [hrn1995 (woo-hc)](https://wordpress.org/support/users/aguinaldodarla/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/adding-code-to-success-page/#post-17030683)
 * Status: resolved