Title: Getting data direct from database
Last modified: July 9, 2020

---

# Getting data direct from database

 *  Resolved [emzdesign](https://wordpress.org/support/users/emzdesign/)
 * (@emzdesign)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/getting-data-direct-from-database/)
 * I’m working on a website that’s using a discount pricing plugin for logged in
   users. So when a user is logged in it will give them a 10% on all prices.
 * I’ve got the plugin to show the discounted price but it isn’t showing the original
   price, which I want to display to show the saving the customer is getting.
 * Is there an SQL query I can do that will get the original price straight from
   the database?
 * Thanks.

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

 *  [con](https://wordpress.org/support/users/conschneider/)
 * (@conschneider)
 * Engineer
 * [5 years, 11 months ago](https://wordpress.org/support/topic/getting-data-direct-from-database/#post-13100295)
 * Hi there,
 * > Is there an SQL query I can do that will get the original price straight from
   > the database?
 * WooCommerce has a couple of public functions to retrieve product info.
 *     ```
       global $product;
       $product = wc_get_product( $post_id );
       ```
   
 * And then:
 *     ```
       $product->get_regular_price();
       $product->get_sale_price();
       $product->get_price();
       ```
   
 * Kind regards,
 *  Plugin Support [Thu P. a11n](https://wordpress.org/support/users/thup90/)
 * (@thup90)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/getting-data-direct-from-database/#post-13143621)
 * Hi there,
 * I hope you found the previous reply helpful. We haven’t heard back from you in
   a while, so I’m going to mark this as resolved – if you have any further questions,
   you can start a new thread.

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

The topic ‘Getting data direct from database’ 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

 * [PRICES](https://wordpress.org/support/topic-tag/prices/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 2 replies
 * 3 participants
 * Last reply from: [Thu P. a11n](https://wordpress.org/support/users/thup90/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/getting-data-direct-from-database/#post-13143621)
 * Status: resolved