Created
April 3, 2020 16:51
-
-
Save RiFi2k/30788e9c2c3d664c1fe37862dea80de5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( class_exists( 'woocommerce' ) ) { | |
if ( is_wc_endpoint_url( 'order-pay' ) ) { | |
global $wp; | |
$order_id = $wp->query_vars['order-pay']; | |
$order_author_id = get_post_field( 'post_author', $order_id ); | |
$current_user_id = get_current_user_id(); | |
if ( $order_author_id !== $current_user_id ) { | |
// Do something here when user did not place the order. | |
// Redirect to homepage etc. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment