Skip to content

Instantly share code, notes, and snippets.

@CrispDev
Created January 21, 2019 17:24
Show Gist options
  • Save CrispDev/be1812b56f49a6437676f1678e2708fd to your computer and use it in GitHub Desktop.
Save CrispDev/be1812b56f49a6437676f1678e2708fd to your computer and use it in GitHub Desktop.
Default Autoship by default instead of one-time purchase
// Default the Autoship option for both Simple and
// Variable products by default.
function xx_default_autoship_for_all( $default ){
return 'yes';
}
add_filter('autoship_default_product_schedule_options_choice_value', 'xx_default_autoship_for_all', 10 ,1);
@davbradley
Copy link

Important Notes:

  • always test on a staging or development site first before publishing to your production site
  • this code snippet should be added to the functions.php file in your active theme (or child theme)
  • the "xx" value makes the name of the function unique. You can use it as-is (xx) or replace it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment