Set a custom field to all orders
You can achieve this via the save_post hook as per the following example: function wpse_374688_save_post( $post_id, $post, $update ) { // only update orders (post_type=shop_order) if ( ‘shop_order’ !== $post->post_type ) { return; } update_post_meta( $post_id, ‘activecampaign_for_woocommerce_accepts_marketing’, 1 ); } add_action( ‘save_post’, ‘wpse_374688_save_post’, 10, 3 ); This callback will run each type a post_type of … Read more