This code enables you to automatically include variation featured images in a easy to customize slider, no plugins required. You can show your variation images in :
- Any number of columns
- With navigation arrows
- With pagination dots below the slider
- In any WooCommerce single product page hook position
The slider.js settings also enable you to change the number of columns at different screen widths so your slider is responsive when showing more than 1 column of variation images.
In this example, we remove the main product page image and replace it with the slider of variation images :
By default, the carousel is coded to display 3 variation images on desktops, 2 @ 768 px width and 1 @ 480 px screen width.
In this example above, we hook the carousel of variation images in below the main product image.
Demo Video
Shows the variation images hooked into the woocommerce_product_thumbnails
hook as a 3 column carousel as well as a single column slider.
Installation
There’s 3 simple steps :
- Add the PHP code to the end of your child themes functions file.
- Upload the slider.js file to your child theme folder.
- Copy and paste the CSS to the end of your child themes style.css file and clear caching.
Once you’ve added variation images to your variations, they will display in a slider below your main product image.
Leave a Reply
You must be logged in to post a comment.