Tagged: x
-
AuthorPosts
-
March 13, 2017 at 2:34 am #1404503
mdmason23ParticipantHello,
I’m trying to add an image after my “add to cart” button on my product pages. I found the following thread in this forum and added the suggested coding:
https://community.theme.co/forums/topic/image-under-add-to-cart-button/My image ended up appearing right at the bottom of the page over-writing the footer, and the javascript text was visible underneath when viewing a product page in customizer. Nothing shows when viewing the website outside customizer.
I have added the code to my website so you can see what is happening.
Can you please tell me what I am doing wrong?
Thanks!
March 13, 2017 at 2:44 am #1404514
ChristopherModeratorHi there,
Please update your code to :
jQuery ( function( $ ) { $('<img src="http://placehold.it/350x50" alt="Image after SKU"/>').insertAfter('.button.single_add_to_cart_button.button.alt'); } );Hope it helps.
March 13, 2017 at 2:51 am #1404517
mdmason23ParticipantI updated the javascript as recommended, and am seeing no change. I will include login credentials in a private reply.
March 13, 2017 at 2:52 am #1404518
mdmason23ParticipantThis reply has been marked as private.March 13, 2017 at 3:14 am #1404532
Paul RModeratorHi,
Please remove the script in your Custom JS that reads
<script type="text/javascript" src="https://cdn.ywxi.net/js/1.js" async></script>You cannot add it there as it will cause a js error and prevent other scripts from working.
To add it, add this in your child theme’s functions.php file.
function add_js_script() { ?> <script type="text/javascript" src="https://cdn.ywxi.net/js/1.js" async></script> <?php } add_action( 'wp_footer', 'add_js_script' );Hope that helps.
March 13, 2017 at 3:33 am #1404550
mdmason23ParticipantThank you! One last question…how can I center the image and nudge it down a little bit?
March 13, 2017 at 3:46 am #1404562
ChristopherModeratorHi there,
Please update previous JS code to :
jQuery ( function( $ ) { $('<img src="https://www.taiyaz.com/wp-content/uploads/2017/03/payments-seals.jpg" alt="Image after SKU"/ style="margin: 0 auto;display: block;margin-top: 10px;">').insertAfter('.button.single_add_to_cart_button.button.alt'); } );Hope it helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1404503 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
