I am working on building a custom integration from WooCommerce to our internal ERP. I hooked into the woocommerce_checkout_order_processed
so that when an order is placed I send all relevant information to our ERP and the reply is an order ID. This is a different order ID than what is in WooCommerce and I need a way to map the ERP order ID to the WooCommerce order. What is the best way to accomplish this?
I have tried adding custom metadata, but so far that has failed.
add_metadata( "shop_order", $order->id, "mapics_order", (string) $orderNumber, TRUE );
and am trying to avoid using wc_add_order_item_meta
since this is not item specific, but for the entire order itself.