WP-Admin: Default Product Frequency Override Option

Default the optional setting "Select to override the default frequency options." checkbox in the WP-Admin > Products > Edit Product >> Product Data >> Autoship tab for a Product with ID 506.

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 "Select to override the default frequency options." checkbox
* in the Edit Product > Autoship Tab for Product with ID 506
*
* @param string $override The current value of the default for the checkbox
* @param int $product_id The WC Product ID for the simple or variation
* @return string The filtered default.
*/
function xx_override_custom_frequencies ($override, $product_id){
    return 506 == $product_id ? 'yes' : $override;
}
add_filter('autoship_override_simple_frequency_options_default', 'xx_override_custom_frequencies', 10, 2);

Still need help? Contact Us Contact Us