WooCommerce – template_redirect if is_checkout AND order has been paid?

I figured it out. woocommerce_payment_succesful_result guided me in the right direction, although it wasn’t the final answer. function is_wc_endpoint_url() is really useful here, it checks where woocommerce is about to redirect next. // redirect empty checkouts and completed orders. add_action( ‘template_redirect’, ‘myfunction’ ); function myfunction() { if( is_wc_endpoint_url( ‘order-received’ ) && isset( $_GET[‘key’] ) ) … Read more

How to get users data from wordpress woocomerce database to display

WooCommerce uses a custom post type “shop_order” to store orders. This means that the orders will be stored in the wp_posts database table with the post_type column set to shop_order SELECT ID, post_author, post_date, post_status, post_type FROM wp_posts WHERE post_type=”shop_order” WooCommerce stores a large portion of the order related data as post meta. Once you … Read more