Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. function change_image_varition_source( $src, $value_slug, $tax_slug ) {
  2. $product = new WC_Product_Variable( get_the_ID() );
  3. $variations = $product->get_available_variations();
  4.  
  5. foreach ( $variations as $variation ) {
  6.  
  7. $src = $variation['image']['thumb_src'];
  8. }
  9.  
  10. return $src ;
  11. }
  12. add_filter( 'woocommerce_swatches_get_swatch_image', 'change_image_varition_source', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement