Variation Swatches for WooCommerce icon
eCommerce & WooCommerce

Variation Swatches for WooCommerce hooks reference

  • By Brainstorm Force
  • v1.0.14
  • Updated

Variation Swatches for WooCommerce 1.0.14 has 1 actions and 14 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when Variation Swatches for WooCommerce fires an action
add_action( 'woocommerce_ajax_added_to_cart', function( $product_id ) {
	// Your code runs here.
}, 10, 1 );

// Change a value Variation Swatches for WooCommerce is about to use
add_filter( 'cfvsw_available_variations', function( $json_encode ) {
	// Change $json_encode here.
	return $json_encode;
}, 10, 1 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • inc/swatches.php line 478
    apply_filters( 'cfvsw_available_variations', wp_json_encode( $available_variations ) );
  • inc/swatches.php line 773
    apply_filters( 'cfvsw_is_required_page', $this->requires_global_settings() || $this->requires_shop_settings() );
  • admin/attributes-config.php line 76
    apply_filters( 'cfvsw_is_required_screen_for_swatch_types', isset( $current_screen->base ) && 'product_page_product_attributes' === $current_screen->base );
  • inc/swatches.php line 786
    apply_filters( 'cfvsw_requires_global_settings', is_product() );
  • inc/swatches.php line 799
    apply_filters( 'cfvsw_requires_shop_settings', is_shop() || is_product_category() || is_product_taxonomy() );
  • inc/swatches.php line 634
    apply_filters( 'cfvsw_swatches_shop_page_position', [ 'before_title' => [ 'action' => 'woocommerce_shop_loop_item_title', 'priority' => 0, ], 'after_title' => [ 'action' => 'woocommerce_shop_loop_item_title', 'priority' => 9999, ], 'before_price' => [ 'action' => 'woocommerce_after_shop_loop_item_title', 'priority' => 9, ], 'after_price' => [ 'action' => 'woocommerce_after_shop_loop_item_title', 'priority' => 11, ], ] );
  • plugin_locale

    filter
    plugin-loader.php line 169
    apply_filters( 'plugin_locale', $get_locale, 'variation-swatches-woo' );
  • inc/swatches.php line 727
    apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_POST['product_id'] ) );
  • inc/swatches.php line 733
    apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variation );
  • inc/swatches.php line 738
    do_action( 'woocommerce_ajax_added_to_cart', $product_id );
  • inc/swatches.php line 462
    apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product );
  • inc/swatches.php line 759
    apply_filters( 'woocommerce_cart_redirect_after_error', get_permalink( $product_id ), $product_id );
  • inc/swatches.php line 482
    apply_filters( 'woocommerce_out_of_stock_message', __( 'This product is currently out of stock and unavailable.', 'variation-swatches-woo' ) );
  • inc/swatches.php line 708
    apply_filters( 'woocommerce_product_add_to_cart_text', $product->add_to_cart_text(), $product );

Generated from Variation Swatches for WooCommerce's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

We can build the customisation for you. Describe what you need: