Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function change_image_varition_source( $src, $value_slug, $tax_slug ) {
- $product = new WC_Product_Variable( get_the_ID() );
- $variations = $product->get_available_variations();
- foreach ( $variations as $variation ) {
- $src = $variation['image']['thumb_src'];
- }
- return $src ;
- }
- add_filter( 'woocommerce_swatches_get_swatch_image', 'change_image_varition_source', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement