WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[Plugin: WooCommerce - eCommerce plugin for WordPress] Featured product on home page using product&# (7 posts)

  1. mattmikulla
    Member
    Posted 2 years ago #

    I want to create a featured box on my home page that displays the latest featured product.

    The catch is I want this image to use the single product image (large) and not a catalog image thumbnail.

    Having the excerpt and link to product page would be ideal as well.

    I asked at the support forum and all they told me was beyond the shortcodes available a custom solution is necessary.

    This is a pretty big functionality oversight in my opinion.

    Any ideas on how to achieve this?

    http://wordpress.org/extend/plugins/woocommerce/

  2. Mike
    Member
    Posted 2 years ago #

    Hi Matt,

    Its not really a functionality oversight because its easily done through a custom loop, if you know what your doing. You do it exactly the same way as you would with posts.

    http://codex.wordpress.org/Class_Reference/WP_Query

    $my_query = new WP_Query( array(
    'post_status' => 'publish',
    'post_type' => 'product',
    'meta_key' => 'featured',
    'meta_value' => 'yes',
    'posts_per_page => 1
    ) );
    
    if ($my_query ->have_posts()) : while ($my_query ->have_posts()) : $my_query ->the_post();
    
    // Output your product here...
    
    endwhile;
    endif;

    Mike

  3. mattmikulla
    Member
    Posted 2 years ago #

    Thanks.

    I asked on the support forum and didn't get any specifics.

    Could you please give me a functioning code example?

  4. jameskoster
    Member
    Plugin Author

    Posted 2 years ago #

    You'd probably get a much better response if you stopped claiming that your own personal requirements not being part of the core plugin are a 'big oversight'.

    Just my 2c :-P

  5. lloydo3000
    Member
    Posted 2 years ago #

    I don't really know what I'm doing so it's taken me a lot of fiddling to get it going. I finally have my featured products loop working, but only after I changed the 'meta_key' => '_featured' -- note the underscore there.

    This problem might exist in WooStore as well, but I thought I'd reply to this topic in public in case someone wonders why Mike's snippet isn't working. Consider it a 2c refund :-b

  6. pyarasujal
    Member
    Posted 2 years ago #

    Hi Guys,
    Thanks for sharing your experience. Actually I want to display featured products with thumbnail. Can you please let me know the code for the thumbnainl?

    Thanks in advance.

  7. riyota
    Member
    Posted 1 year ago #

    pyarasujal there is a featured products widget. I think that you should be able to use that?

    I'm actually trying to use it and I'm having trouble to make it horizontal.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic