- This topic has 30 replies, 2 voices, and was last updated 1 year, 3 months ago by Leo.
-
AuthorPosts
-
September 5, 2019 at 9:15 am #1001902David
Really struggling with this, any other ideas??
September 5, 2019 at 9:51 am #1001927TomLead 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_footer
hook:<script> jQuery( document ).ready( function( $ ) { $( '.request-info-button' ).clone().insertAfter( '.woocommerce-product-gallery__wrapper' ); } ); </script>
September 6, 2019 at 1:27 am #1002353DavidThanks 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 #1002763TomLead 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 #1004549DavidThanks Tom
September 9, 2019 at 9:10 am #1004938TomLead DeveloperLead DeveloperYou’re welcome π
September 18, 2019 at 5:20 am #1012430DavidHi 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 #1012799TomLead 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 #1013280DavidHi 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 #1013844TomLead 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 #1014185DavidStill 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 #1014675TomLead 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 #1014685DavidYES! that did it π Thanks Tom.
http://185.20.51.60/~envirotechalarms/product/water-leak-detection-multizone-alarms/
September 20, 2019 at 10:07 am #1014690TomLead DeveloperLead DeveloperYou’re welcome π
January 11, 2023 at 9:17 am #2491695PaulAlong 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.