fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

“Hide Main Product Image” does not seem to be correctly evaluated

Hello,

I am strugling to understand how Hide Main Product Image is supposed to work.
My expectation for this option is that if Hide Main Product Image is not checked the main image is included in the gallery, also when a variation without a variation gallery is selected. My expectaion is that is always present, if this option is not checked, except for when a variation with a gallery has been selected.

Instead, the main image is included only in the initial gallery, when the page is loaded and no variation has been selected yet.
As soon as one of the variations is selected, regardless of whether or not the variation has a gallery or just a variation image, the main product image is removed from the gallery.
This is the behaviror that I would expect if Hide Main Product Image is checked. Not the opposite.

Moreover, if Show Default Gallery Image is checked I would expect that the variation gallery combined with the default gallery included the main product image, if Hide Main Product Image is not checked. That is because the main product image should be part of the default gallery, unless I explicitely select that option.

Don’t you agree that this is confusing and counterintuitive?
Also, this is a potentially missed feature, because the only way I can mitigate this issue is to check Hide Main Product Image, therefore choose to hide the main product image, and then add the main product image back in the gallery again, so that is shown as part of the default gallery, but this causes issues with other features and extension in WooCommerce.

Is this working as intended, or what I am seeing is the result of a bug or some mistake in the logic?

Hakik Zaman

Hi Patrick,

Thanks for reaching out to us.

Please check this screencast to understand how the `Hide Main Product Image` & `Show Default Gallery Image`  options work.

I hope it will clear up your confusion.

Thank You

Hi,

I have watched the screencast. Thank you for doing it.
However, this does not add anything to my understanding of the behaviour of these options, the point that I am trying to make here is that the behaviour is not logically sound and it goes against the default behaviour of WooCommerce.

The point is that if the Main Product Image is not hidden, by default, it becomes part of the product gallery.
That should mean that if I check “Show Default Gallery Image” when the Main Product Image is not hidden, the main product image should be shown as part of the gallery when I select a variation.

As seen in your screencast, it does not make sense that the red t-shirt image appears in the gallery, along with all others, only when the red variation is selected. Being a variation and being that the Main Product Image is not hidden, that image should be shown in the gallery for all variations, exactly as all the other images in the product gallery.
That is, because by default, that image should be part of the product gallery.

As I said in my previous message, this conflicting behaviour force me hide the Main Product Image and then add the same image to the gallery to have it shown as part of the gallery when “Show Default Gallery Image” is selected.
However, this causes issues with other WooCommerce features, because it makes that image a duplicate inside the gallery.
To accomodate the configuration needed for your plugin, now I am forced to have the same image shown twice in the gallery in other WooCommerce views.

What I am suggesting you and asking you to do is to make that behaviour consistent with WooCommerce defaults, which is that the Main Product Image is part of the gallery, in all views, for all variations, unless I explicitely check “Hide Main Product Image”.

I hope you can accomodate this request, because the current behaviour makes your plugin less valuable.
We are using it for now, and we considering becoming paying customers, but that’s not possible unless this logical bug is fixed.

Hakik Zaman

Hi Patrick,

I have shared your request with our team.

The options you have indicated were implemented by the requests of customers like you. Initially, it was not in our plugin settings. Customers force us to add the mentioned feature and many of them are happy with that.

What I am suggesting you and asking you to do is to make that behaviour consistent with WooCommerce defaults, which is that the Main Product Image is part of the gallery, in all views, for all variations, unless I explicitely check “Hide Main Product Image”.

You can use this snippet using a plugin called Code Snippets. It will display the main product image in all views, for all variations.

Thank You

Hi Hakik,

Thank you for your reply, the snippet was very useful.

After testing it, it have found that it was working almost as I intended, so I created another version, which works as I expected.

You can find it here

Your version had one problem, which was that the product image was taking the place of the variation image, because it was put at the beginning of the array when

array_unshift( $gallery_images, $product_image_id );
was executed after evaluating whether the variation had a variation image.

When a user selected a variation, instead of seeing the variation image, it was always seeing the product image.
Moreover, as you can see in my version, the product image is always added as the the first image of the product gallery, unless “Remove main product image from gallery” is selected.
This is what I think that option should be used for, and how.

There is still one issue, which is that if “Remove main product image from gallery” is selected, it should remove the product image from the gallery only when a variation has been selected. Instead it is removed also when no variation has been selected.
To be honest, this last one, I am not even 100% convinced myself that it is the best interpretation and there is also a back compatibilty issue in doing any changes around it.
This could lead to a completely different discussion regarding adding another option entirely for the last use case.
But in my head, it kinda of make sense that it should affect only the variation gallery and not the product gallery when a variation has not been selected yet.

Anyway, for now, with the changes I made it is serving my purpose well.
Thank you again for your help. Appreciated.

Patrick

Hi again,

I have wrapped your solution into a custom plugin for our needs.
This works for now, but it would be nice if you could consider adding these changes to your plugin indefinitely.
I never like having to maintain this hacky solutions.

Potentially this could be implemented through a new option, to avoid issues with other customers, as they may rely on the absence of the product image when “Show Variation Gallery image with default gallery image” is selected.
As I said before, I find the relation among these two options so conflicting and confusing that I don’t know why anyone would like that behaviour, but it is comprehensible that they might have found a way to work with that and it wouldn’t be nice to break it for them.

I am interested to hear your thoughts about my version of the “get_available_variation_gallery” function, if you think that it make sense to adopt that behaviour officially, or add it to the list of the available options maybe.
I understand if you want to keep things as they are, but I hope you see why my version could be a better implementation.

Thank you

Hakik Zaman

Hi Patrick,

Thanks for your feedback and sending us the modified snippet. I have shared your suggestions with our development team. They have agreed and will try to add your requested behavior.

However, we do have some existing users who are already utilizing the current options. To accommodate both the new behavior and the needs of our existing users, the team has decided to introduce a new option. Below is a summary of the available options:

Hide Main Product Image: It will remove the main product thumbnail.
Show Default Gallery Image (with the main thumbnail) (New option): It will display the default gallery with the variation gallery. 
Show Default Gallery Image (without the main thumbnail).: For backward compatibility. It will display the default gallery with the variation gallery but will remove the main product thumbnail. 

We hope this solution strikes a balance between the requested features and user experience.

Please let us know if you have any further questions or additional feedback.

Thank You

Hi Hakik,

It sounds like the best solution.

Looking forward to seeing it released.

Thank you

Hakik Zaman

Hi Patrick,

To reduce the complexity for the users we have kept the following options:

Hide Main Product Image: It will remove the main product thumbnail.
Show Default Gallery Image: It will display the default gallery (with the main product image) with the variation gallery. 

Please update the plugin to the latest release 1.3.26. I hope you will enjoy the current setup.

Hope to hear from you soon.

Thank You

Hi Hakik,

Well, it seems that we came full circle at the end. I have tested the new version and it works exactly as I expected.

Actually, it works exactly as I expected when I opened the ticket.

Hide Main Product Image: It will remove the main product thumbnail.
Show Default Gallery Image: It will display the default gallery (with the main product image) with the variation gallery. 

This was how I thought it should have worked since the beginning. I am happy to see that we have all agreed that this was the best solution.

Thank you for looking into this and for solving this issue for good.
Very appreciated.

Patrick