Quantcast
Channel: WordPress.org Forums » [WooCommerce] Support
Viewing all articles
Browse latest Browse all 104029

Coen Jacobs on "woocommerce_available_variation - how to do own filter?"

$
0
0

Please take my advice and read the documentation I linked to. This is not how you should use a filter. Quick example of how it should be done:

add_filter( 'woocommerce_available_variation', 'cj_ woocommerce_available_variation' );

function cj_ woocommerce_available_variation( $variations ) {
array_push( $variations, array( 'test_key' => 'test value' );
return $variations;
}

This adds the array( 'test_key' => 'test value' ) to the array (via the filter woocommerce_available_variation) and then returns it.


Viewing all articles
Browse latest Browse all 104029

Trending Articles