Woo Commerce Product producing bad HTML - <a tag nested within another <a tag

<div class="entry-featured"><a href="/desks-incorporated.com/product/red-guest-chairs/"></a><a href="/desks-incorporated.com/product/red-guest-chairs/" style="outline: none;"><img width="250" height="275" src="http://desks-incorporated.com/wp-content/uploads/2017/06/20170627_102445-250x275.jpg" class="attachment-shop_catalog size-shop_catalog wp-post-image" alt="20170627 102445 250x275 Denver Office Furniture Solutions" title="Denver Office Furniture Solutions"></a></div>

How do I know which template file to edit?
I have latest x-theme 5.1.1 and supported woo commerce. 2.5.5

visit www.desks-incorporated.com and look at the section titles Recently added used office furniture for the example above.

I can provide login info as needed.

Hi,

The latest supported version of Woocommerce is Version: 3.1.1

Kindly update your woocommerce plugin to that version and see if that fixes the issue.

Thanks

Upgraded wc to 3.1.1 and the issue remains.
Basically, I am trying to clean up any HTML errors. validator.w3.org is finding these.
There are other errors as well please run the check on the validator against our website. Some errors are basic HTML syntax related and appear to be coming from x-theme or Visual Composer. We are using x-child and I believe the templates are up to date.
Let me know if you need access.

Hi there,

The issue is originating from the shortcode, which I think product related shortcode. And yes, I can see many duplicate instances of <a>. Would you mind providing your admin and FTP login credentials in a secure note? I just like to see and test directly. I don’t see this in my installation with the same shortcode so I can’t rule out that this is a bug, yet.

Thanks!

Hi there,

It should be okay now here http://b48.66a.myftpupload.com/test/, just copy the file /x/woocommerce/content-product.php to your live one.

I checked and X doesn’t have that template so it’s probably a custom one. And it has too many filters that wrap the entire loop item that caused the malformed layout.

Thanks!

Hi and thank you for your assistance. However, when I placed the content-product.php file on the production side and cleared the cache it only displayed in 2 columns on the home page. It can’t figure out why.
If I create a test page it works fine. There must be some content on the home page that is breaking it.

Hi there,

It looks like due to cache, it’s now displaying 4 columns with 2 rows products. The same thing happens when I’m checking the issue and I tried multiple workarounds, and the first one is the solution which I thought wasn’t working. So it’s due to your hosting’s cache.

Thanks!

Did you notice that I renamed the file on the production side to content-product-bad.php because it wasn’t working?
Anyway, there are other html errors the validator uncovered. Did you view the results?

https://validator.w3.org/nu/?doc=http%3A%2F%2Fdesks-incorporated.com%2F

Hey Scott,

Aside from the errors Rad mentioned were due to your customizations, the only other error I saw was an issue with placing a h4 tag inside the custom headline element. Using a custom headline will already provide the heading tag.

If you just remove the wrapping h4 there, it should resolve the error.

I just figured out that there isn’t a cache issue. While you were testing the staging site was at woocommerce 2.5 and was working with your content-product.php file. As soon as I updated woocommerce to 3.1.1 it went back to not working correctly.
So, can you help me isolate which custom template file I should edit? I inherited this beast and would like to look at the code.
For now I changed the file name to content-product-bad in both staging and production.
Thank you so much.

I found an article where woocommerce admits to the invalid HTML of a nested <a tag and basically says they are leaving it like this. I am not happy about this. So, please help me get things to display correctly with it at latest version. My limited understanding is that my x/woocommerce is the only place for custom wc templates. You are telling me that we have a customized version but that file content-product didn’t exist so you kind a lost me there.

Hi There,

What where saying is, we don’t customize that part of the template, so the error is not coming from the theme as you have confirmed. The issue is coming from this file: \wp-content\plugins\woocommerce\templates\content-product.php on line 35 you can see

   * @hooked woocommerce_template_loop_product_link_open - 10

Which point to the hooks on this file \wp-content\plugins\woocommerce\includes\wc-templates-hooks.php** around line 93 and 94 of the code. As you can see on this folder: *\wp-content\themes\x\woocommerce* there’s no content-product.php file in there. As this is still a third party plugin issue, it will be best to forward the question to the plugin developer. As stated a dirty fixed here is not recommended because it might cause some issues/conflict in the future. It would be best to address the root cause of the issue from the first place which the plugin developer can do best. Thank you for understanding.