Skip to content

Instantly share code, notes, and snippets.

View TanvirHasan19's full-sized avatar
🏘️
Working from home

Tanvir Hasan TanvirHasan19

🏘️
Working from home
View GitHub Profile
@TanvirHasan19
TanvirHasan19 / Lead Capture Plugin - Hooks Reference.md
Created November 29, 2025 05:19
WooCommerce Wholesale Lead Capture Plugin - Hooks Reference

WooCommerce Wholesale Lead Capture Plugin - Hooks Reference

Registration Form Hooks

Action Hooks (do_action)

  1. before_registration_form
    • Location: includes/class-wwlc-shortcode.php:298
    • Parameters: $registration_form_fields (array)
  • Description: Fires before the registration form is rendered
@TanvirHasan19
TanvirHasan19 / functions.php
Created November 21, 2025 09:23
JavaScript to DISABLE burger menu completely - show all items in main bar
/**
* JavaScript to DISABLE burger menu completely - show all items in main bar
* This prevents any items from being moved to the burger menu
*/
function wcv_disable_burger_menu() {
// Only run on dashboard pages
if ( ! function_exists( 'wcv_is_dashboard_page' ) || ! wcv_is_dashboard_page() ) {
return;
}
?>
@TanvirHasan19
TanvirHasan19 / functions.php
Created November 12, 2025 07:33
Workaround for BOGO Coupon Not Working with Regular Coupons
<?php
/**
* Workaround for BOGO Coupon Not Working with Regular Coupons
*
* This snippet fixes the issue where BOGO coupons don't apply correctly
* when a regular WooCommerce coupon is already in the cart.
*
* DO NOT MODIFY PLUGIN CORE FILES
* Add this to your theme's functions.php or a custom plugin
*
@TanvirHasan19
TanvirHasan19 / Sale Price & Language Fixes.md
Created November 12, 2025 03:24
Sale Price & Language Fixes

Developer Quick Reference: Sale Price & Language Fixes

Quick Fix Summary

Sale Price Validation

File: classes/class-get-products.php
Lines: 2883-2916
What it does: Validates sale prices before including in feeds

Language Translation

@TanvirHasan19
TanvirHasan19 / functions.php
Created November 6, 2025 16:02
Add Wholesale Prices to WooCommerce CSV Export
function wwpp_add_wholesale_price_export_columns( $columns ) {
// Check if wholesale prices plugin is active
if ( ! class_exists( 'WWP_Wholesale_Prices' ) ) {
return $columns;
}
// ============================================
// CUSTOMIZE THIS: Set your wholesale role key
// ============================================
@TanvirHasan19
TanvirHasan19 / functions.php
Created November 6, 2025 04:31
WC Vendors Google Merchant Center Integration
<?php
/**
* WC Vendors Google Merchant Center Integration
*
* This code provides the missing functionality to retrieve vendor shipping data
* from a product object for Google Merchant Center feed generation.
*/
/**
* Get vendor ID from a WooCommerce product object
@TanvirHasan19
TanvirHasan19 / functions.php
Created November 3, 2025 10:27
Limit Points Redemption to Percentage of Cart Value
// ==============================================================================
// LPFW Percentage Limit - Limit Points Redemption to Percentage of Cart Value
// ==============================================================================
add_action('admin_footer', function() {
$screen = get_current_screen();
if (!$screen || (strpos($screen->id, 'woocommerce') === false && strpos($screen->id, 'acfw') === false)) {
return;
}
?>
<script type="text/javascript">
@TanvirHasan19
TanvirHasan19 / functions.php
Created October 30, 2025 04:19
Adds a username field to WC Vendors Signup and uses it when creating the user.
/**
* Username Field
* Description: Adds a username field to WC Vendors Signup and uses it when creating the user.
*/
defined( 'ABSPATH' ) || exit;
add_filter( 'wcv_signup_form_config', function( $config ) {
$config = is_array( $config ) ? $config : array();
@TanvirHasan19
TanvirHasan19 / functions.php
Created October 23, 2025 04:12
Add vendor header on Elementor single product template.
/**
* Add vendor header on Elementor single product template.
*/
add_action( 'wp_footer', 'wcv_elementor_js_vendor_header' );
function wcv_elementor_js_vendor_header() {
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
@TanvirHasan19
TanvirHasan19 / functions.php
Created September 2, 2025 06:55
WC Vendors - Regenerate Missing Vendor Orders
<?php
/**
* WC Vendors - Regenerate Missing Vendor Orders
*
* This script regenerates missing vendor sub-orders for cases where:
* - Products were initially published under Administrator
* - Product author was later corrected to vendor
* - Commission was recalculated but vendor orders are missing from Orders menu
*
* IMPORTANT: