Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created August 25, 2025 07:44
Show Gist options
  • Select an option

  • Save webtoffee-git/87dfe90642b10de1566cd410e83b1b80 to your computer and use it in GitHub Desktop.

Select an option

Save webtoffee-git/87dfe90642b10de1566cd410e83b1b80 to your computer and use it in GitHub Desktop.
Compatibility issue with Gift Card templates on Product page - By WebToffee (WebToffee WooCommerce Gift Cards free version)
<?php //do not copy this line of code
add_action('woocommerce_before_single_product', function(){
if(function_exists('is_product') && is_product() && class_exists('Wbte_Gc_Gift_Card_Free_Common'))
{
global $product;
if(!empty($product)
&& method_exists('Wbte_Gc_Gift_Card_Free_Common', 'is_gift_card_product')
&& method_exists('Wbte_Gc_Gift_Card_Free_Common', 'is_templates_enabled')
&& Wbte_Gc_Gift_Card_Free_Common::is_gift_card_product($product->get_id())
&& Wbte_Gc_Gift_Card_Free_Common::is_templates_enabled($product->get_id())
) {
do_action( 'woocommerce_before_single_product_summary' );
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment