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 / functions.php
Last active January 21, 2026 08:18
Add this as a small MU-plugin or in your theme/plugin (so updates won’t overwrite it):
/**
* WC Vendors Pro: clean up shipping label and avoid "Vendor Shipping".
*/
add_filter( 'wcvendors_pro_shipping_label', function( $label, $vendor_id, $rate ) {
// Change this if you want a different default.
$fallback_method = 'Standard Shipping';
$vendor_term = function_exists( 'wcv_get_vendor_name' ) ? wcv_get_vendor_name( true, true ) : 'Vendor';
@TanvirHasan19
TanvirHasan19 / functions.php
Created January 15, 2026 04:52
Fix HTML entities in XML feeds
/**
* Fix HTML entities in XML feeds
*/
add_filter( 'adt_product_feed_xml_attribute_handling', function( $handled, $product, $key, $value, $feed_config, $channel_attributes, $feed ) {
if ( $handled || ! is_object( $product ) || ! is_object( $feed ) ) {
return $handled;
}
$target_feed_id = 37281;
$is_target_feed = false;
@TanvirHasan19
TanvirHasan19 / functions.php
Created January 13, 2026 04:26
Hide the Helpful Resources and Plugins & Licenses cards with CSS and JavaScript
/**
* Hide the Helpful Resources and Plugins & Licenses cards with CSS and JavaScript
*/
function hide_wcv_dashboard_sections() {
// Only load on the marketplace dashboard page
$screen = get_current_screen();
if ( ! $screen || 'wc-vendors_page_wc-vendors-marketplace-dashboard' !== $screen->id ) {
return;
}
?>
@TanvirHasan19
TanvirHasan19 / functions.php
Created January 13, 2026 02:28
Fix filter priorities to ensure custom fields load before data manipulation
/**
* Fix filter priorities to ensure custom fields load before data manipulation
*/
add_action( 'plugins_loaded', function() {
// Only run if Product Feed Elite classes exist
if ( ! class_exists( '\AdTribes\PFE\Classes\Extra_Attributes' ) ||
! class_exists( '\AdTribes\PFE\Classes\Product_Data_Manipulation' ) ) {
return;
}
@TanvirHasan19
TanvirHasan19 / functions.php
Last active January 13, 2026 03:13
Alternative code for functions.php
<?php
/**
* Add this code to your theme's functions.php file
*
* FINAL SOLUTION - Table Rate Shipping Cheapest Rate Fix
*
* This improved solution fixes the issue where Table Rate Shipping returns multiple rates
* for products without shipping labels, and the feed incorrectly shows the most expensive rate.
*
* To enable debugging, add this line to wp-config.php (temporarily):
@TanvirHasan19
TanvirHasan19 / functions.php
Last active January 13, 2026 03:13
Standalone plugin (recommended approach)
<?php
/**
* Plugin Name: Product Feed - Table Rate Shipping Cheapest Rate Fix (Final Solution)
* Description: Filters shipping data to only include the cheapest shipping rate per country/region for products without shipping labels. This fixes the issue where Table Rate Shipping returns multiple rates and Google Merchant Center picks the most expensive one.
* Version: 3.0.0
* Author: AdTribes Support
*
* FINAL SOLUTION - Addresses all issues:
* - Works for both Product Feed Pro and Product Feed Elite
* - Handles all price formats correctly (including edge cases)
@TanvirHasan19
TanvirHasan19 / functions.php
Created January 8, 2026 06:39
remove resource and license
function remove_wcv_helpful_resources( $resources ) {
return array();
}
add_filter( 'wcv_helpful_resources', 'remove_wcv_helpful_resources', 10, 1 );
/**
* Hide the Helpful Resources and Plugins & Licenses cards with CSS and JavaScript
*/
function hide_wcv_dashboard_sections() {
// Only load on the marketplace dashboard page
@TanvirHasan19
TanvirHasan19 / functions.php
Created January 7, 2026 10:23
Default SKU Sorting for WooCommerce Wholesale Order Form
/**
* Default SKU Sorting for WooCommerce Wholesale Order Form
*
* This snippet sets the default sorting to SKU (lowest to highest)
* when the order form is first loaded (no search, no explicit sorting).
*
* Copy this entire code into Code Snippets plugin
*/
add_filter( 'wwof_posts_clauses_request', 'wwof_default_sku_sorting', 10, 2 );
@TanvirHasan19
TanvirHasan19 / functions.php
Created January 7, 2026 10:22
SKU Search Relevance Fix for WooCommerce Wholesale Order Form
/**
* SKU Search Relevance Fix for WooCommerce Wholesale Order Form
*
* This snippet fixes the SKU search to prioritize exact matches first,
* then SKUs starting with the search term, then partial matches.
*
* Copy this entire code into Code Snippets plugin
*/
add_filter( 'wwof_search_post_clauses_request', 'wwof_sku_search_relevance_ordering', 10, 2 );
@TanvirHasan19
TanvirHasan19 / functions.php
Created January 6, 2026 04:44
Push wholesale user data to Google Tag Manager data layer
/**
* Push wholesale user data to Google Tag Manager data layer
*/
function wws_push_user_data_to_datalayer() {
// Only run on frontend
if ( is_admin() ) {
return;
}