Please refer to TemplateMonster Support for any issues surrounding TemplateMonster/TemplateTuning Themes – thanks, Jigoshop Team

"View Product" button instead of "Add to Cart" button on shop category page

max's Avatar

max

25 Feb, 2012 09:46 AM

Hi experts, I am wondering if it is possible to have a "view product" button instead (or additional to) the "add to cart" button on the category page. Or is it possible to add a short description to the items on the category page? I don't think that an "add to cart" button makes sense if there is no item description but an image only.
Thanks for any tips!

  1. 2 Posted by brettcind on 24 May, 2012 06:38 AM

    brettcind's Avatar

    I to am looking for an answer to this.
    I have replaced the add to cart button with an image which I would like to click through to the product itself, don't want them to be able to add straight to the cart.
    http://www.buildbusinessblogs.com/dev-sites/beestitched/party-range/

  2. Support Staff 3 Posted by ivica on 24 May, 2012 08:15 AM

    ivica's Avatar

    Hi guys! As I saw on this Forum, it is possible (everything is possible
    :-)), bout you would have to find and freelancer to do it for you, maybe to
    put your offer to Jobs section of this Forum?

  3. 4 Posted by Matt on 24 May, 2012 01:52 PM

    Matt's Avatar

    Relatively simple, add the below to wp-content/yourTheme/functions.php:

    remove_action( 'jigoshop_after_shop_loop_item', 'jigoshop_template_loop_add_to_cart', 10, 2);
    add_action( 'jigoshop_after_shop_loop_item', 'jigoshop_template_loop_add_to_cart_custom', 10, 2);
    
    function jigoshop_template_loop_add_to_cart_custom( $post, $_product ) {
    
        do_action('jigoshop_before_add_to_cart_button');
    
        // do not show "add to cart" button if product's price isn't announced
        if ( $_product->get_price() === '' AND ! ($_product->is_type(array('variable', 'grouped', 'external'))) ) return;
    
        if ( $_product->is_in_stock() OR $_product->is_type('external') ) :
            if ( $_product->is_type(array('variable', 'grouped')) ) :
                $output = '<a href="'.get_permalink($_product->id).'" class="button">'.__('Select', 'jigoshop').'</a>';
            elseif ( $_product->is_type('external') ) :
                $output = '<a href="'.get_post_meta( $_product->id, 'external_url', true ).'" class="button">'.__('Buy product', 'jigoshop').'</a>';
            else :
                $output = '<a href="'.get_permalink($_product->id).'" class="button">'.__('View product', 'jigoshop').'</a>';
            endif;
        elseif ( ($_product->is_type(array('grouped')) ) ) :
            return;
        else :
            $output = '<span class="nostock">'.__('Out of Stock', 'jigoshop').'</span>';
        endif;
        echo $output;
    
        do_action('jigoshop_after_add_to_cart_button');
    
    }
    
  4. 5 Posted by brettcind on 28 May, 2012 01:34 PM

    brettcind's Avatar

    Thanks Matt, thats great.
    Brett

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.