WordPress filter hook
woocommerce_duplicate_product_exclude_meta
Defined by WooCommerce and fired by 6 plugins in total, running on 7M+ sites between them.
“Filter to allow us to exclude meta keys from product duplication..”
How to use woocommerce_duplicate_product_exclude_meta
It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'woocommerce_duplicate_product_exclude_meta', function( $value, $map ) {
// Change $value here.
return $value;
}, 10, 2 );Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
6 plugins that fire woocommerce_duplicate_product_exclude_meta
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
apply_filters( 'woocommerce_duplicate_product_exclude_meta', array(), array_map( function ( $datum ) { return $datum->key; }, $product->get_meta_data() ) )includes/admin/class-wc-admin-duplicate-product.php:148 -
Bulky10,000+ installs
apply_filters( 'woocommerce_duplicate_product_exclude_meta', array(), array_map( function ( $datum ) { return $datum->key; }, $product->get_meta_data() ) )admin/ajax.php:658 -
WPMelon Advanced Bulk Edit for WooCommerce300+ installs
apply_filters( 'woocommerce_duplicate_product_exclude_meta', [], array_map( static fn( \WC_Meta_Data $meta ) => $meta->key, $source->get_meta_data() ) )includes/Services/Operations_Service.php:659 -
Salevo Boost Sales for WooCommerce200+ installs
apply_filters( 'woocommerce_duplicate_product_exclude_meta', array() )admin/zcrosssell.php:189 -
Food Products for WooCommerceFewer than 10 installs
apply_filters( 'woocommerce_duplicate_product_exclude_meta', array(), $aMetaKeys )inc/product-types/class--product-types.php:684 -
WEBD Woo Event BookingsFewer than 10 installs
apply_filters( 'woocommerce_duplicate_product_exclude_meta', array( 'total_sales' ) )includes/admin/functions.php:66
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.