Check if Flag “VIRTUAL” was set for an order
-
In order to change afterwards the Order Status Flag after Purchasing is complete I wanted to check if the Virtual Flag has been set for the Product which was part of the order.
If the Virtual Flag was Part of the Order I wanted to change the ORDER Status myself via PHP code. But how to get this specific flag after a purchase has been done.
Example code inside functions.php:
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); function custom_woocommerce_auto_complete_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); $order->update_status( 'completed' ); }
But this example covers everything also the ones which are set as not Virtual.
Any idea from where to get the values to put them into the piece of code?Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Check if Flag “VIRTUAL” was set for an order’ is closed to new replies.