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/ae41d3492c3080251d5e5cb4affed831 to your computer and use it in GitHub Desktop.
Save somewherewarm-snippets/ae41d3492c3080251d5e5cb4affed831 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Restore Add to Cart buttons in Shop Archives
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this snippet to hide cart item subscription options.
* Version: 1.0
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Developer: Jason Kytros
*
*
* Copyright: © 2021 Automattic.
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
add_action( 'init', 'apfs_restore_add_to_cart_buttons_in_shop_archives' );
function apfs_restore_add_to_cart_buttons_in_shop_archives() {
remove_filter( 'woocommerce_product_add_to_cart_text', array( 'WCS_ATT_Display_Product', 'add_to_cart_text' ), 10, 2 );
remove_filter( 'woocommerce_product_add_to_cart_url', array( 'WCS_ATT_Display_Product', 'add_to_cart_url' ), 10, 2 );
remove_filter( 'woocommerce_product_supports', array( 'WCS_ATT_Display_Product', 'supports_ajax_add_to_cart' ), 10, 3 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment