How to add a ‘Related Products’ section

How to add related products in DukaPress

Related products in DukaPress - click to see larger image

Have you ever wondered how to show “Related products” or “You may also like…” on your product pages? This can help improve sales significantly since you are subtly telling the customer to buy more products by showing them more products.

As it happens, ti is very easy for you to add this feature. Here’s how:

In all your products, add the grid display shortcode but limit the number of products you show to the category and number of products you want.

Look at this product for an example. The following is the shortcode that generates the three similar products at the bottom:

[dpsc_grid_display category=”3” total=”3″ column=”3″ per_page=”3″ type=”duka”]

Simple, eh? have fun playing with it!

Some notes:

  1. Unfortunately, there is a bug that prevents the product variations from working properly when you add this element to your product pages.
  2. You’ll be pleased to know that we are building something nice and elegant to fix the above bug – a new DukaPress module that deals with related products. Thanks to Donal for this idea.
  3. Now, once you set this up, you will quickly realise that you need a way to choose the order of the products displayed because currently it will only show them in chronological order. We are adding the ability for you to select the order in which the products shown by the grid display shortcode appear. Initially, it will be: chronologically, alphabetically, and randomly.

What do you think of all this?

32 Responses

  1. Pam says:

    This is great idea. When do you think the module will be ready? I am setting up dukapress on I need it for the digital downloads and am really happy with it so far. I will be keeping a close eye on what else you bo.


  2. ChilliMango says:

    I love your site though I’m feeling a bit bombarded by the text. Will go through it and do the necessary. Quite impressive I must say..

    • Kelvin says:

      Thanks! Please know that we’d be more than happy to help! We have two video tutorials to make the reading lighter 😛

  3. J-P says:

    For related products display, do you have a way of excluding the product that is being viewed from the related products result if it is in the same category?


  4. Hajar says:

    Hi there,
    I am using dukapress to build my e store, it is lot better than what i thought it would be. however I am struggling with my products, I need to add digital products I tried everything and nothing seems to work. No picture is showing and no link for the digital file.
    Any suggestions? As the documentation doesn t much about digital products

  5. thirteen says:

    Great feature. Is there any way I can grab “related products” by tags instead? I suppose I could use a WordPress plugin for “related posts” as I already do but I want it to specifically work for each individual product page (I want to have a sidebar with the related products in a list format). Not including the blog posts I have outside of the store page.

    Thanks for any help.

  6. thirteen says:

    Oh, and is there a way to have a different template for the individual product pages? I don’t want it to use the general “page.php” or “single.php” template because the individual product page will have different widgets on the left-hand side.

    • thirteen says:

      So, to clarify, I want Duka to grab the “shop” page and use the same template for all individual product pages, instead of grabbing and using the “news” page as it’s doing now.

      What I did is program WP so that there are different sidebars depending on the page you’re on. The “news” page uses the default sidebar. In order for my sidebar method to work properly, pages have to be created (these pages will contain posts). There is no page currently for the individual product pages. It’s just using the single.php or page.php template. Let me know if you want access to the back-end. It’s hard to explain here.

  7. thirteen says:

    OK, I figured out the second question today. So I’m just curious to know if there’s any way I can grab “related products” by tags instead…

    • Kelvin says:

      Unfortunately, WordPress makes this really hard because it does not yet support custom post types in archives. This will be fixed in WP 3.1.

      Also, DukaPress does not natively support tags, just categories. You’re the very first to ask about tags, and we’re thinking it would be good to do so.

      • thirteen says:

        OK, thanks. I’ll see if there’s some kind of plugin I can use to remedy this problem. Right now tags and related posts would be good, but if I can’t figure out the “related products” thing I will end up using just tags in the hopes that someone can click on those to see more products with the same tags (since Duka products show up in the search results).

      • thirteen says:

        I attached tags to each Duka product post (there’s a tag field when I make new posts, just like with regular posts). This way when I display tags I can specify to only show the tags of that product on its own page instead of showing every existing tag on my site. So if anyone wants related posts they can use the search feature to find similar posts and products. Or even click on the tag itself. I wish there was a way to search only custom (Duka) posts, so I’ll look around for a plug-in or the next version of WordPress. Thanks again.

  8. Jeff says:

    I can not get my credit card fields to come up. Anybody have this problem?

  9. Jeff says:

    Hey Kelvin, no I have my gateway with and Paypal but when you want to check out there is no field for information. That is something the shopping cart should provide and then that info is sent to Authorize I believe. I will check the other links.

  10. Jeff Hardy says:

    Kelvin I got my problem worked out and have made successful transactions. What it is is If you are an advanced integration user, you supply them with the payment fields etc. and have to have your own SSL certificate but you can opt to use their input page and their SSL which is what I did. When you say make payment it goes straight to a page that you configure in your account.

  11. Rushels says:

    Hi Kelvin?

    I am trying to find a way to edit the font setting for grid_product_image. How can i change it for this site to be more elegant?

  12. Tariq says:

    LOVE Dukapress!

    Quick question: Is there a way to apply the order=”rand” to the dukapress product display widget? So that every page the user visits will have a new, random product displayed in the sidebar.

    Thanks in advance…and thanks for all the effort and brains that went into creating this amazingly simple and efficient plugin.

    Kind regards,


    • Kelvin says:

      Of course there is. But currently you have to edit some of DukaPress code :(. Are you okay with this?

      • Tariq says:

        I’ve been playing with code foe the past two days 🙂

        I think I know where to change things…but it hasn’t worked so far:

        In the dp-widgets.php file the following section:

        $widget_products = get_posts(‘numberposts=’ . $instance[‘number’] . ‘&post_type=’ . $instance[‘type’] . ‘&meta_key=price&category=’ . $instance[‘category’] . ‘orderby=post_date&order=asc’);

        I’ve tried messing with the orderby part…but still no luck till now.

        Any guidance would be much appreciated 🙂

        • Tariq says:

          SUCCESS! 🙂

          I still really don’t know WHY this syntax works…but it does 🙂

          Here is the solution to my own problem – in case somebody else comes is interested:

          To display random product in product widget edit section in dp-widgets.php file as follows:

          change the occurance of ‘orderby=post_date&order=desc’);



Leave a Reply

© 2018 DukaPress. All rights reserved.
Design By Madoido.