Order received - M-Powered Projects

Order received

function get_order_id_thankyou( $atts ) {
// Only in thankyou “Order-received” page
if( ! is_wc_endpoint_url( ‘order-received’ ) )
return; // Exit

global $wp;

// Get the order ID
$order_id = absint( $wp->query_vars[‘order-received’] );

if ( empty($order_id) || $order_id == 0 )
return; // Exit;

// Testing output (always use return with a shortcode)
return ‘

Order ID: ‘ . $order_id . ‘

‘;
}
add_shortcode( ‘my_order_id’, ‘get_order_id_thankyou’);