I’m trying to list my upsells products as a dropdown instead of the usual list. Normally, each product is displayed with the thumbnail, image, price and an add-to-cart-button.
I’ve customize my templates a bit and managed to display my upsells in a dropdown, with a single add-to-cart-button next to it. However, no matter what option I pick in the dropdown, it’s always the first/default option from the dropdown that is added when I click the button.
What do I need to do to make the button catch the selected option from the dropdown?
This is the code I have in the /single-product/up-sells.php file;
<div class="upsells products"> <h2><?php _e( 'You may also like…', 'woocommerce' ) ?></h2> <select> <?php while ( $products->have_posts() ) : $products->the_post(); ?> <option value="<?php the_title(); ?>"> <?php the_title(); echo ' - '; woocommerce_get_template( 'loop/price.php' ); ?> </option> <?php endwhile; // end of the loop. ?> <?php do_action( 'woocommerce_before_shop_loop_item' ); ?> <?php do_action( 'woocommerce_after_shop_loop_item' ); ?> </select> </div>
- The topic ‘Display upsells as dropdown’ is closed to new replies.