8manos / wc-variations-radio-buttons

Let your customers choose product variations using radio buttons instead of dropdowns.
https://wordpress.org/plugins/wc-variations-radio-buttons/
GNU General Public License v2.0
62 stars 34 forks source link

Add out of stock class to radio buttons #22

Open Garconis opened 7 years ago

Garconis commented 7 years ago

It seems hit or miss, but even with "Hide out of stock items from the catalog" checked, the "out of stock" variations still do not show. They are supposed to show, but as "disabled". However, this is not the case. They seem to work rarely, but most of the time they aren't showing at all.

Can you simply do this via a CSS class instead? It would be ideal to have all variations always show... but add a "disabled" class to each variation div, so that we can more easily control styling and/or visibility ourselves.

Mantish commented 7 years ago

Do you have a link where to check this? I haven't been able to reproduce this problem

Garconis commented 7 years ago

http://freshyjon.wpengine.com/product/product-name/

Size 2 and 10 are out of stock... but not showing.

Mantish commented 7 years ago

Are you sure you have a variation for those sizes and those variations are enabled? what happens when you disable the plugin? do you get those sizes in the select dropdown?

Garconis commented 7 years ago

Yes, I have variations set up correctly. Here is the variations for the item:

Here is the WooCommerce setting enabled, that is necessary to show them as "disabled": https://gyazo.com/a2b7c5ee2c340c2d5cc7bcca1856ceb6

When I deactivate the plugin, those sizes do NOT show in the dropdown ... but I assume that's because I have it toggled for them to "Hide out of stock items from the catalog".

Mantish commented 7 years ago

I wasn't able to reproduce this. What versions of wp and wc are you using? Also can you try deactivating all others plugins to discard any conflicts?

Garconis commented 7 years ago

I'm using the latest versions of everything.

I also deactivated all other plugins (only WooCommerce and your plugin were activated). And I activated the 2017 theme. The problem was still there. The "out of stock" products did not show:

https://gyazo.com/5bafb0318ad593fbf30f9f369a7b1b6e

Regardless... if you are not experiencing this on your end... it may be a server/PHP/cache issue? I just toggled the "Hide out of stock items from the catalog" again and cleared my server cache (I use WPEngine). And it works again. http://freshyjon.wpengine.com/product/product-name/

But as mentioned originally, it seems hit-or-miss. Sometimes it works, sometimes it doesn't.

Either way, if you were able to add a "disabled" class to the div, I could then uncheck "Hide out of stock items from the catalog"... and then style the "disabled" radio button accordingly. However, at this time, there is no specific class to distinguish between disabled and in-stock options (when "Hide out of stock items from the catalog" is unchecked). https://gyazo.com/b5f7f68c5f5788121b0f4a8d18548244

Mantish commented 7 years ago

From what you describe, the problem seems to be related with the cache of your site. However it could be useful to add the class that you mention. Would you be able to implement it and submit a pull request?

Garconis commented 7 years ago

Unfortunately I'm not yet familiar enough with PHP to be able to implement such a feature.