Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save somewherewarm-snippets/decc5de9657df8e0d7d09f1648fa9794 to your computer and use it in GitHub Desktop.
Save somewherewarm-snippets/decc5de9657df8e0d7d09f1648fa9794 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Hide Global Subscription Plans on product pages
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this plugin to hide Global Subscription Plans on product pages
* 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_show_single_product_options', 'hide_global_plans_on_product_pages', 10, 2 );
function hide_global_plans_on_product_pages( $show_plans, $product) {
$subscription_schemes = WCS_ATT_Product_Schemes::get_subscription_schemes( $product, 'local' );
if ( empty( $subscription_schemes ) ) {
$show_plans = false;
}
return $show_plans;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment