crosspeaksoftware / scaffolding

Responsive Design Scaffolding for WordPress
https://scaffolding.io
86 stars 39 forks source link

Filtering out image dimensions breaks Woocommerce product photos #134

Closed fregan closed 6 years ago

fregan commented 6 years ago

Hello, A client brought it to my attention today that the thumbnails and lightbox for Woocommerce are not working correctly when using this as a base theme. Specifically it seems that the following line in base-functions.php is causing the issue:

add_filter( 'post_thumbnail_html', 'scaffolding_remove_img_dimensions', 10 );

This results in the following error for some images in product photo galleries:

Uncaught TypeError: Cannot read property 'x' of undefined
    at Pe (photoswipe.min.js:4)
    at $t (photoswipe.min.js:4)
    at Object.setContent (photoswipe.min.js:4)
    at Object.init (photoswipe.min.js:4)
    at t.openPhotoswipe (single-product.min.js:1)
    at HTMLDivElement.dispatch (jquery.js:3)
    at HTMLDivElement.r.handle (jquery.js:3)

Doing a little research I was able to find the following: https://github.com/woocommerce/woocommerce/issues/15376

This states that removing the image dimensions will indeed break the functionality introduced into WooCommerce 3.0. I can try and figure out a work around for now but wanted to bring it to your attention if it already has not been done so.

jlavoie13 commented 6 years ago

Thank you for your report. This was actually resolved 259b756. Have not discovered any other problems with the lightbox since.