WordPress filter hook

woocommerce_attribute_default_is_variation

Defined by WooCommerce and fired by 7 plugins in total, running on 7M+ sites between them.

How to use woocommerce_attribute_default_is_variation

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:

functions.php
add_filter( 'woocommerce_attribute_default_is_variation', function( $value, $product_type ) {
	// 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.

7 plugins that fire woocommerce_attribute_default_is_variation

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_attribute_default_is_variation', ProductType::VARIABLE === $product_type ? 1 : 0, $product_type ) includes/class-wc-ajax.php:799
  2. Dropshipping XML Import for WooCommerce icon Dropshipping XML Import for WooCommerce700+ installs apply_filters( 'woocommerce_attribute_default_is_variation', 1 ) vendor_prefixed/wpdesk/woocommerce-dropshipping-xml-core/src/Service/Mapper/Product/ProductAttributeMapperService.php:119
  3. WUPO Group Attributes for WooCommerce icon WUPO Group Attributes for WooCommerce400+ installs apply_filters( 'woocommerce_attribute_default_is_variation', 0 ) admin/class-wugrat-admin.php:656
  4. WPC Smart Attribute Groups for WooCommerce icon WPC Smart Attribute Groups for WooCommerce300+ installs apply_filters( 'woocommerce_attribute_default_is_variation', 0 ) includes/class-backend.php:396
  5. Add Product Frontend for WooCommerce icon Add Product Frontend for WooCommerce70+ installs apply_filters( 'woocommerce_attribute_default_is_variation', 0 ) public/inc/bytes-product-attributes.php:24
  6. StoreSuite icon StoreSuite20+ installs apply_filters( 'woocommerce_attribute_default_is_variation', ProductType::VARIABLE === $product_type ? 1 : 0, $product_type ) includes/Product/VariationAjax.php:69
  7. Invoice management for Woocommerce icon Invoice management for WoocommerceFewer than 10 installs apply_filters( 'woocommerce_attribute_default_is_variation', 0 ) includes/class-wc-ajax.php:579

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.