Support » Plugin: WooCommerce » Check if product variation has image

  • Resolved SpabRice

    (@spabrice)


    Hello,

    I just came across a strange thing in woocommerce. For a custom project I want to check if a product variation (for example: color -> blue,green,grey) has an image selected.

    I can get all the variation datas with this:
    $variations = $product->get_available_variations();

    I then get an array with all the variation datas like price, image, etc.
    Here is the strange thing: If I don’t select any image it takes the datas of the global featured image. This means that I never can check if a variation has an image selected or not. I think it’s very strange.

    Maybe someone can give me some inside into this or an alternative how I can check if a variation has selected an image or not.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Check if product variation has image’ is closed to new replies.