I'm trying to create a payment gateway and I need to get the WooCommerce order ID. Problem is the notice I'm getting and to be fair, I am new to the world of WordPress and WooCommerce.
Notice: Notice: ID was called incorrectly. Order properties should not be accessed directly.
This is my code:
public function get_order_details( $post ) {
if ( $post->post_type=="shop_order" ) :
$order = new WC_Order( $post );
if ( $order ) :
I'm later, whenever needed, referencing it like this: <?php echo $order->get_id; ?>
I'm using the latest WP and WC versions. If anyone can point me in the right direction in terms of how to get the Order ID from my plugin, I would really appreciate it.