Viewing 6 replies - 16 through 21 (of 21 total)
  • Hi guys, sorry for popuping in late but I was wondering if somebody can tell me how to change the feature image’s link and the titile just for a SINGLE product without affecting the rest??? or just how to disabled it. I am using another plugin that allows users to develop their own product and when you click on the image or title, it takes you to the product page and I don’t want that.

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    You’d need to add conditonal code to your function to check product ID. If you need a dev, use jobs.wordpress.net

    that section actually changed. Now it looks like this:

    <td class="product-name">
    						<?php // Avada edit ?>
    						<span class="product-thumbnail">
    							<?php
    								$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
    
    								if ( ! $_product->is_visible() )
    									echo $thumbnail;
    								else
    									printf( '<a href="%s">%s</a>', $_product->get_permalink( $cart_item ), $thumbnail );
    							?>
    						</span>
    						<div class="product-info">
    						<?php
    							if ( ! $_product->is_visible() )
    								echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key );
    							else
    								// Avada edit
    								echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a class="product-title" href="%s">%s</a>', $_product->get_permalink( $cart_item ), $_product->get_title() ), $cart_item, $cart_item_key );

    what line do I need to change??

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    meyao stick to your own thread please. You posted twice.

    Sorry Mike I will. I am a little frustrated. I cannot figure it out.
    I don’t know how or where I have to put $_product->id and then where to add the link.
    I know the product id is 606, that’s all. could you please help me here?

    this would work?
    $special_products = array(606);
    and then

    if ( ! $_product->is_visible() ) {
       echo $thumbnail;
    } else {
        if ( in_array($_product->id, $special_products) ) {
            echo 'Something else, whatever you like';
        } else {
            printf( '<a href="%s">%s</a>', $_product->get_permalink( $cart_item ), $thumbnail );
        }
    }

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘remove link to Woocommerce single product page from shop & cart pages’ is closed to new replies.