Skip to content

Instantly share code, notes, and snippets.

View shameemreza's full-sized avatar
🇧🇩
I fix the WooCommerce problems that keep merchants stuck.

Shameem Reza shameemreza

🇧🇩
I fix the WooCommerce problems that keep merchants stuck.
View GitHub Profile
@shameemreza
shameemreza / wc-af-cleanup.sql
Created July 27, 2026 02:18
WooCommerce Anti-Fraud (OPMC) — complete removal of leftover data.
-- WooCommerce Anti-Fraud (OPMC) — complete removal of leftover data.
--
-- For phpMyAdmin / Adminer / any MySQL client, when WP-CLI is not available.
-- Take a full database backup before running this. It deletes data permanently.
--
-- IMPORTANT: this file assumes the default table prefix `wp_`. If the site uses
-- a different prefix, replace every `wp_` below with the real one first.
--
-- Two things this file cannot do — handle them separately, see notes at the end:
-- 1. Scheduled cron events
@shameemreza
shameemreza / aw-per-workflow-sender.php
Created April 21, 2026 09:08
Override AutomateWoo's "From" name and email on a per-workflow basis.
// Purpose: Override AutomateWoo's "From" name and email on a per-workflow basis.
// Note: Edit the $senders map below. Workflow IDs are visible in the URL when
// editing a workflow in wp-admin (e.g. post=123).
if ( ! class_exists( 'AW_Per_Workflow_Sender' ) ) {
final class AW_Per_Workflow_Sender {
/**
* Map of workflow ID => array( 'name' => string, 'email' => string ).
@shameemreza
shameemreza / woocommerce-remove-customer-reply-to-admin-emails.php
Created February 25, 2026 02:29
Removes the customer billing email from the Reply-To header on admin order notification emails and replaces it with the store’s configured sender email so replies stay within the store team.
/**
* Remove the customer's billing email from the Reply-To header on admin
* order notification emails (New Order, Cancelled Order, Failed Order)
* so that replies stay within the store team.
*
* Replaces the Reply-To with the store's configured "Email from" address
* from WooCommerce > Settings > Emails > Email sender options.
*
* Requires WooCommerce 3.7+.
*
@shameemreza
shameemreza / remove-administration-email-verification.php
Created February 15, 2026 15:59
Remove WordPress Administration Email Verification
add_filter( 'admin_email_check_interval', '__return_false' );
@shameemreza
shameemreza / disable-wcpf-on-search-pages.php
Created January 28, 2026 05:26
Disable Product Filters for WooCommerce on search results pages.
<?php
/**
* Disable Product Filters for WooCommerce on search results pages.
*
* This prevents the performance-heavy filter queries from running on search pages
* while keeping filters active on shop, category, and other catalog pages.
*
* @param int|null $filter_id The filter project ID.
* @return int|null The filter ID, or null to disable on search pages.
*
@shameemreza
shameemreza / dismiss-wcshipping-migration-notice.php
Created January 25, 2026 04:20
Dismiss the persistent "WooCommerce Shipping has successfully been installed and activated" admin notice. Use when the dismiss button fails due to blocked AJAX requests (403 errors from security plugins/firewalls).
<?php
/**
* Dismiss WooCommerce Shipping Migration Notice
*
* Fixes the persistent "WooCommerce Shipping has successfully been installed
* and activated — enjoy the new WooCommerce Shipping experience." notice
* that won't dismiss due to blocked AJAX requests (403 errors).
*
* Usage: Add via Code Snippets plugin (admin only), then deactivate after use.
*
@shameemreza
shameemreza / add-gtin-to-quick-edit.php
Created December 8, 2025 10:52
Adds a GTIN field to the WooCommerce Quick Edit panel, allowing store managers to view and update GTIN values directly from the product list
/**
* Add GTIN Field to WooCommerce Quick Edit Panel
*
* Allows viewing and editing GTIN from the Quick Edit dropdown.
*/
/**
* Get the GTIN field label (same as product settings).
*
* @return string
@shameemreza
shameemreza / add-gtin-column-to-products-list.php
Created December 8, 2025 10:45
Adds a GTIN column to the WooCommerce Products table, making it sortable and searchable.
/**
* Add GTIN Column to WooCommerce Products List Table
*
* Adds a sortable, searchable GTIN column to Products > All Products.
*/
// Add GTIN column to products list (positioned after SKU).
add_filter( 'manage_edit-product_columns', function( $columns ) {
// Find SKU position and insert after it.
$sku_position = array_search( 'sku', array_keys( $columns ), true );
/**
* Disable Min/Max "Group of" quantity rules for bundled products.
* This allows bundled items to have a quantity of 1 even when the
* standalone product has a "Group of 6" rule.
*
* @author Shameem Reza
*/
// Product Bundles side - disable Group of for bundled item calculations.
add_filter( 'woocommerce_bundled_item_group_of_quantity', '__return_zero', 999 );
@shameemreza
shameemreza / hide-variations-for-specific-products-vaspfw.php
Created November 17, 2025 04:43
Custom code to hide variations for selected products when using the Variations as Single Products plugin.
/**
* Hide variations for specific products when using Variations as Single Products plugin
* Add product slugs to the $target_products array below
*/
add_filter( 'posts_clauses', 'vaspfw_hide_specific_variations', 99998, 2 );
function vaspfw_hide_specific_variations( $clauses, $query ) {
global $wpdb;
// Only apply to variation queries
if ( ! isset( $query->query_vars['vaspfw_single_variation_filter'] ) ||