Product Page: Default Option to Autoship Instead of One-Time Purchase

Changes the default selection on the product page to Autoship instead of One-Time purchase.

  • 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.

Important: Always test customizations to your site on a staging environment before making changes to your live / production site. If you are not experienced with testing changes on a staging site, here is a good article to review.

 // 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);

Still need help? Contact Us Contact Us