Script for adding Woocommerce Img Alt tags

Joined
Dec 17, 2015
Messages
204
Likes
123
Degree
1
So one of my sites is an online gallery and the theme has various sections where it brings product images in dynamically. The trouble is it doesn't provide an option for the alt tag. I see there are a few plugins which automatically add the img alt based on the file name but you have to buy the premium version for it to work with woocommerce images.

I don't mind this too much but is there really much to it or is it just a small script that could be done manually?
 
I've not messed with WooCommerce that much, but I imagine you could create a child theme and duplicate the template that has the loop for displaying these images. It shouldn't be hard to find the correct functions to do something like, but not exactly <img alt="<?php get_the_title($attachment_ID) ?>" />. Of course I'd have to see the code to know what data is already available in the loop or what extra code would be required. It could be simple or complicated depending on what's already happening with the dynamic images and how they're stored.

Or buy that premium plugin you're talking about.
 
Thanks, I'm happy to buy it but figured if it was just a simple line of code then I'd rather not have to stump up the cash or indeed have yet another plugin for it.
 
Back