Need to change product image url on shop page

Question

I need to change or remove the link from the image (red box image(sugar scrub) to a different url I need it to go to the custom page. It needs to be in the child function page. The url for the image needs to match the button. I attached images. Site is my-pocket.cc
Code for the button and what I tried.
enter image description here

// Display Price For Variable Product With Same Variations Prices

add_filter(‘woocommerce_available_variation’, function ($value, $object = null, $variation = null) {
if ($value[‘price_html’] == ”) {
$value[‘price_html’] = ” . $variation->get_price_html() . ”;
}
return $value;
}, 10, 3);

function ssp_always_show_variation_prices($show, $parent, $variation) {
return true;
}
add_filter( ‘woocommerce_show_variation_price’, ‘ssp_always_show_variation_prices’, 99, 3);

function remove_loop_button(){
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );
}
add_action(‘init’,’remove_loop_button’);

add_action(‘woocommerce_after_shop_loop_item’,’replace_add_to_cart’);
function replace_add_to_cart() {
global $product;
$link = $product->get_permalink();
$name = $product->get_title();

       echo '<style>';
       echo '.ip-shop-loop-actions{';
       echo 'margin-top: 10px;';
       echo 'fill: #56B0F2;';
       echo 'display: flow-root;';
       echo '}</style>';

            
       
        echo '<div style="text-align:center;display:flow-root;">';
       
       echo "<a href='http://www.my-pocket.cc/3551-2/?Id=" . $name . "'><button style='background-color: #fba129;width:100%;'>Find Store</button></a></a>";
       echo "<br><br><br>";   
       echo '</div>';
        
        
    }

/**

  • Remove image links from WooCommerce thumbnail images

*/

add_filter(‘woocommerce_single_product_image_thumbnail_html’,’wc_remove_link_on_thumbnails’ );

function wc_remove_link_on_thumbnails( $html ) {
return strip_tags( $html,” );
}

add_filter(‘woocommerce_single_product_image_html’, ‘custom_unlink_single_product_image’, 10, 2);

0
rr944276 3 months 0 Answers 8 views 0

Leave an answer