Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
webtoffee-git / functions.php
Created December 9, 2025 11:07
Custom code snippet to include subtotal, Shipping amount, Cart discount, Order discount, Fee, Order total and payment method in the QR code - By WebToffee
<?php //Do not copy this line of code
add_filter("wf_pklist_alter_find_replace_in_qrcode", "add_order_details_to_qrcode_currency_code", 10, 6);
function add_order_details_to_qrcode_currency_code($find_replace_in_qrcode, $template_type, $order, $box_packing, $order_package, $custom_qr_details) {
if (!is_a($order, 'WC_Order')) {
return $find_replace_in_qrcode;
}
$currency_code = $order->get_currency();
@webtoffee-git
webtoffee-git / functions.php
Created December 9, 2025 10:59
Code snippet to your active theme's functions.php and check - By WebToffee
<?php //do not copy this line of code
add_filter('wf_pklist_alter_footer_data','wf_pklist_show_custom_footer_data', 10, 3);
function wf_pklist_show_custom_footer_data($footer_data, $template_type, $order) {
if( $template_type == 'invoice' ) {
if('IN' == $order->get_billing_country()){
$footer_data = __('your custom footer data for India','wt-woocommerce-invoice-addon');
}
}
return $footer_data;
}
@webtoffee-git
webtoffee-git / gist:f7c9957e1ff88be18ee02178f625bf25
Created December 8, 2025 09:27
Code snippet to disables the additional Category Mapping fields added by the WebToffee Product Feed & Sync Manager plugin (Facebook, Google, Fruugo, OnBuy, etc.) on the Product Category page - By WebToffee
<?php //Do not copy this line of code
add_action( 'admin_init', 'wt_remove_category_mapping_fields', 999 );
function wt_remove_category_mapping_fields() {
global $wp_filter;
// Remove Facebook Category field (function-based)
remove_action( 'product_cat_edit_form_fields', 'wt_fbfeed_category_form_fields', 10 );
remove_action( 'product_cat_add_form_fields', 'wt_fbfeed_category_form_fields', 10 );
@webtoffee-git
webtoffee-git / Functions.php
Created September 29, 2025 10:27
Geo-Targeting US State Law Privacy Banners - By WebToffee
<?php //Do not copy line of code
add_filter('wcc_ccpa_allowed_regions',array('CA','CO'));
@webtoffee-git
webtoffee-git / function.php
Last active September 29, 2025 11:24
Geo-Target GDPR Cookie Banner - By WebToffee
<?php //Do not copy this line of code
/**
* Add custom cookie consent handler for US visitors
*/
function wcc_custom_cookie_consent_us_handler() {
?>
<script type="text/javascript">
(function() {
// Wait for the cookie consent store to be initialized
const waitForWccStore = setInterval(() => {
@webtoffee-git
webtoffee-git / functions.php
Last active August 26, 2025 07:05
Code to retain Sequential number for old orders even after deactivating the plugin - By WebToffee
<?php //Do not copy this line of code
add_filter('woocommerce_order_number', 'wt_show_old_order_number', PHP_INT_MAX, 2);
function wt_show_old_order_number($order_number, $order)
{
if ($order instanceof WC_Order) {
$meta_value = $order->get_meta('_order_number');
if ($meta_value) {
$order_number = $meta_value;
}
@webtoffee-git
webtoffee-git / functions.php
Created August 25, 2025 07:44
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())
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko; CookieYesbot/1.0; +http://www.cookieyes.com/documentation/cookieyesbot) Chrome/131.0.6778.0 Safari/537.36
@webtoffee-git
webtoffee-git / functions.php
Created June 27, 2025 05:54
Disable Webhook Sleep Delay in Stripe Plugin - By WebToffee ( Stripe Basic plugin )
<?php //do not copy this line of code
add_filter('wtst_webhook_sleep_time', 'set_webhook_sleep_time');
function set_webhook_sleep_time($time) {
return 0;
}
@webtoffee-git
webtoffee-git / Functions.php
Created June 9, 2025 10:00
Code Snippet to override the plugin’s CSS style - By WebToffee(Related products plugin)
<?php> //Do not copy this line of code
add_action('wp_footer',function(){
?>
<style>
.wt-related-products .owl-theme .owl-nav { margin-top: 25px !important; }
</style>
<?php
},10);