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 using the 'autoship_default_product_schedule_options_choice_value' filter. Return 'yes' to default Autoship as the selected option or 'no' to default to One-Time Purchase.

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