Update Custom Order Meta After a Successful Order in WooCommerce

Add this code at the bottom of your theme's functions.php

/* Add Shop Location Meta after order create*/ 
add_action( 'woocommerce_thankyou', 'rb_checkout_save_order_meta'); 
function rb_checkout_save_order_meta( $order_id ) { 
   update_post_meta( $order_id, 'shop_location', 'WW'); 
}

Comments

Popular posts from this blog

Stop video playing when Bootstrap modal is closed