Created
September 22, 2022 04:26
-
-
Save wpacademy/cfb2f01855e492b469ef4e6e38778f79 to your computer and use it in GitHub Desktop.
Order Tracking Page Code for Advanced eCommerce website tutorial by WP Academy
This file contains 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
function wpac_add_query_vars_filter( $vars ){ | |
$vars[] = "order_id"; | |
return $vars; | |
} | |
add_filter( 'query_vars', 'wpac_add_query_vars_filter' ); | |
function wpac_order_status() { | |
if(is_page(1141)){ | |
$id = get_query_var('order_id'); | |
$id = intval($id); | |
$order = wc_get_order($id); | |
if($order) { | |
$status = $order->get_status(); | |
echo $status; | |
} else { | |
echo "No Data Found"; | |
} | |
} | |
} | |
add_shortcode("WPAC_ORDER_STATUS", "wpac_order_status"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment