WordPress.org

Ready to get started?Download WordPress

Forums

[[Woocommerce]] - Displaying product variation inside loop (4 posts)

  1. adamccc
    Member
    Posted 1 year ago #

    Currently in Woocommerce if you have a variable product, it will replace the 'add to basket' button with a 'select options' which then takes you to the product page were you can select the option from dropdown and then add to your basket -

    http://i.imgur.com/SEkDT.png

    I'm looking to modify this so if the product has variations - display the dropdown in the loop_shop.php with a 'add to basket' button so users can add variable products to their basket straight from the catalogue page - like this:

    http://i.imgur.com/XcEaW.png

    Tried pulling in some of variable.php but can't seem to get it to work, wondered if anyone had come across this or has a solution

  2. sk
    Member
    Posted 1 year ago #

    Would be awesome, I'm looking to do something like this too. Have you had any luck yet?

    The file single-product\add-to-cart\variable.php handles the processing, so would need to modify this then call it on the product archive page. If I have any luck I'll post back but might be a bit too much for me.

  3. adamccc
    Member
    Posted 1 year ago #

  4. tubo
    Member
    Posted 1 year ago #

    I got this from a good friend in the past:

    in /woocommerce/content-product.php
    look for do_action( 'woocommerce_after_shop_loop_item' ); and replace it by :

    add_action('woocommerce_after_shop_loop_item','woocommerce_template_single_add_to_cart');
    remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    do_action( 'woocommerce_after_shop_loop_item' );

    Edit the original and create a new file, same name: content-product.php and place it in the themes folder inside woocommerce subfolder. This will do the job, style it and done!

Topic Closed

This topic has been closed to new replies.

About this Topic