Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Force all the users autoship orders to be updated if the user
- * Changes their address info.
- *
- * @param bool $update The current update flag. True updates all orders, false doesn't
- * @param int $user_id The current users id.
- *
- * @return bool The filtered update flag.
- */
- function xx_always_update_my_autoship_scheduled_orders( $update, $user_id ){
- // Add custom code here
- // ex. add a custom "Always apply to my orders" checkbox to user's account
- // and retieve the value from the user's metadata
- $should_update = get_user_meta($user_id, 'my_custom_user_field_always_update', true );
- return empty( $should_update ) ? $udpate : $should_update;
- }
- add_filter('autoship_apply_to_scheduled_orders_by_default', 'xx_always_update_my_autoship_scheduled_orders', 10, 2 );
Add Comment
Please, Sign In to add comment