Skip to content

Instantly share code, notes, and snippets.

@somewherewarm-snippets
Last active July 18, 2023 19:27
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/945bbe317ecb4ad7f26166bc655f582b to your computer and use it in GitHub Desktop.
Save somewherewarm-snippets/945bbe317ecb4ad7f26166bc655f582b to your computer and use it in GitHub Desktop.
Use this snippet to remove the 'Apply Gift Card' form on the cart/checkout pages.
<?php
/**
* Plugin Name: WooCommerce Gift Cards - Remove the 'Apply Gift Card' form on the cart/checkout pages.
* Plugin URI: https://woocommerce.com/products/gift-cards/
* Description: Use this snippet to remove the 'Apply Gift Card' form on the cart/checkout pages.
* Version: 1.1
* 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', 'remove_gc_actions' );
function remove_gc_actions() {
if ( version_compare( WC_GC()->get_plugin_version( true ), '1.7.0' ) > 0 ) {
// Cart
// To hide the Gift Cards form from the cart in v1.7+, navigate to WooCommerce > Settings > Gift Cards and disable "Enable cart page features".
// Checkout
remove_action( 'woocommerce_review_order_before_payment', array( WC_GC()->cart, 'display_form' ), 9 );
} else {
// Cart.
remove_action( 'woocommerce_proceed_to_checkout', array( WC_GC()->cart, 'display_form' ), 9 );
// Checkout.
remove_action( 'woocommerce_review_order_before_submit', array( WC_GC()->cart, 'display_form' ), 9 );
}
}
@Blindmikey
Copy link

This no longer seems to work, is there an updated snippet I've missed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment