Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Select a subscription plan as the default option
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this plugin to select a subscription plan as the default option
* Version: 1.0
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Developer: Jason Kytros
*
* Requires at least: 2.6.0
* Tested up to: 6.8
*
* Copyright: © 2022 Automattic.
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
add_filter( 'wcsatt_get_default_subscription_scheme_id', 'default_to_subscription', 10, 4 );
function default_to_subscription( $default_subscription_scheme_key, $subscription_schemes, $force_subscription, $product ) {
$default_scheme = current( $subscription_schemes );
$default_subscription_scheme_key = $default_scheme->get_key();
return $default_subscription_scheme_key;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment