Use this script to change the main image of the product to a variant one
<script>
var __isp_options = __isp_options || {};
__isp_options.isp_pre_serp_callback = function (data) {
function getSecondImage(product){
if(!product.vra || product.vra.length === 0){
return product.t
}
const image = product.vra[0][1].find(a => a[0] === "imgs");
return image ? image[1][0] : product.t
}
data.items.forEach(product => {
product.t = getSecondImage(product);
})
};
</script>