- This topic has 30 replies, 2 voices, and was last updated 3 years, 2 months ago by
Leo.
-
AuthorPosts
-
September 5, 2019 at 9:15 am #1001902
David
Really struggling with this, any other ideas??
September 5, 2019 at 9:51 am #1001927Tom
Lead DeveloperLead DeveloperWould definitely help if WooCommerce had a hook in that area.
It’s not ideal, but what about using javascript to clone the element and insert it where we want it?
For example, in a Hook Element in the
wp_footerhook:<script> jQuery( document ).ready( function( $ ) { $( '.request-info-button' ).clone().insertAfter( '.woocommerce-product-gallery__wrapper' ); } ); </script>September 6, 2019 at 1:27 am #1002353David
Thanks Tom, that worked although I changed it to this to include the PDF docs…
<script> jQuery( document ).ready( function( $ ) { $( '.pdf-docs' ).clone().insertAfter( '.woocommerce-product-gallery__wrapper' ); $( '.request-info-button' ).clone().insertAfter( '.woocommerce-product-gallery__wrapper' ); } ); </script>Is it possible to remove it from this position on mobile?
Thanks
DaveSeptember 6, 2019 at 10:01 am #1002763Tom
Lead DeveloperLead DeveloperSure, try this:
<script> jQuery( document ).ready( function( $ ) { $( '.pdf-docs' ).clone().insertAfter( '.woocommerce-product-gallery__wrapper' ).addClass( 'hide-on-mobile' ); $( '.request-info-button' ).clone().insertAfter( '.woocommerce-product-gallery__wrapper' ).addClass( 'hide-on-mobile' ); } ); </script>September 9, 2019 at 2:13 am #1004549David
Thanks Tom
September 9, 2019 at 9:10 am #1004938Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
September 18, 2019 at 5:20 am #1012430David
Hi Tom
When adding an image to the product gallery, it’s moved the request more info and PDF docs above the images…
http://185.20.51.60/~envirotechalarms/product/water-leak-detection-multizone-alarms/
Any ideas how I can move it back below, like on the pages that only have one product image…
http://185.20.51.60/~envirotechalarms/product/50mm-to-300mm-wras-approved-water-meters/
Thanks
DaveSeptember 18, 2019 at 9:44 am #1012799Tom
Lead DeveloperLead DeveloperHi there,
Try this code instead:
<script> jQuery( document ).ready( function( $ ) { if ( $( '.flex-control-nav' ).length ) { $( '.pdf-docs' ).clone().insertAfter( '.flex-control-nav' ).addClass( 'hide-on-mobile' ); $( '.request-info-button' ).clone().insertAfter( '.flex-control-nav' ).addClass( 'hide-on-mobile' ); } else { $( '.pdf-docs' ).clone().insertAfter( '.woocommerce-product-gallery__wrapper' ).addClass( 'hide-on-mobile' ); $( '.request-info-button' ).clone().insertAfter( '.woocommerce-product-gallery__wrapper' ).addClass( 'hide-on-mobile' ); } } ); </script>Let me know 🙂
September 19, 2019 at 1:10 am #1013280David
Hi Tom
No luck with that…
http://185.20.51.60/~envirotechalarms/product/water-leak-detection-multizone-alarms/
Any other ideas?
Thanks
DaveSeptember 19, 2019 at 10:41 am #1013844Tom
Lead DeveloperLead DeveloperLet’s try this instead:
<script> jQuery( document ).ready( function( $ ) { $( '.pdf-docs' ).clone().appendTo( '.woocommerce-product-gallery' ).addClass( 'hide-on-mobile' ); $( '.request-info-button' ).clone().appendTo( '.woocommerce-product-gallery' ).addClass( 'hide-on-mobile' ); } ); </script>September 20, 2019 at 12:45 am #1014185David
Still no luck Tom, any other ideas…
http://185.20.51.60/~envirotechalarms/product/water-leak-detection-multizone-alarms/
September 20, 2019 at 9:58 am #1014675Tom
Lead DeveloperLead DeveloperI wonder if it’s because the gallery is being initiated using javascript.
What about this?:
<script> jQuery( window ).load( function() { jQuery( '.pdf-docs' ).clone().appendTo( '.woocommerce-product-gallery' ).addClass( 'hide-on-mobile' ); jQuery( '.request-info-button' ).clone().appendTo( '.woocommerce-product-gallery' ).addClass( 'hide-on-mobile' ); } ); </script>September 20, 2019 at 10:05 am #1014685David
YES! that did it 🙂 Thanks Tom.
http://185.20.51.60/~envirotechalarms/product/water-leak-detection-multizone-alarms/
September 20, 2019 at 10:07 am #1014690Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
January 11, 2023 at 9:17 am #2491695Paul
Along this same line, I am looking to include a simple shortcode to display a special button below the product gallery on both desktop and mobile.
[example_shortcode]
Is it possible to do this?
-
AuthorPosts
- The topic ‘Woocommerce Hook under product image?’ is closed to new replies.