WordPress.org

Forums

WooCommerce - excelling eCommerce
[closed] Duplicate Up-Sells on product page (18 posts)

  1. darrenhunt
    Member
    Posted 2 years ago #

    Hi Guys

    Hoping someone can help, I have installed WooCommerce and am running the Mystile theme. I have added a single product as an Up-Sell. When I look at the product page it shows two 'You may also like...' titles and two associated products.

    Anyone else run into this issue and how did you resolve it please?

    Build page is here for reference: http://demo.happy-camping.co.uk/product/new-camping-gear/new-product/

    Thanks in advance

    Darren

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

  2. absoluteweb
    Member
    Posted 2 years ago #

    Hi,

    I have the same problem on the theme Abundance. There is no problem on the TwentyEleven theme.

    Nicolas.

  3. darrenhunt
    Member
    Posted 2 years ago #

    Ok

    So it displays <div class="upsells products"> twice on the product page, once before and once after related products. I can switch both off by adding the following on the style sheet:

    .upsells.products {
    display: none;
    }

    But obviously don't want to do that, I would like to display one. Anyone know which page /template I need to edit as I assume there is a wordpress hook and a woocommerce hook so I was hoping I could remove one of them?

    Thanks

  4. damien19
    Member
    Posted 2 years ago #

    I am having the same problem. This may not be much help but I have a feeling it is something in theme-woocommerce.php

    This is the code starting on line 85

    // Change columns in related products output to 3 and move below the product summary
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
    add_action( 'woocommerce_after_single_product', 'woocommerce_output_related_products', 20);
    
    if (!function_exists('woocommerce_output_related_products')) {
    	function woocommerce_output_related_products() {
    	    woocommerce_related_products(3,3); // 3 products, 3 columns
    	}
    }
    
    // Change columns in upsells output to 3 and move below the product summary
    remove_action( 'woocommerce_after_single_product', 'woocommerce_upsell_display');
    add_action( 'woocommerce_after_single_product', 'woocommerceframework_upsell_display', 20);
    
    if (!function_exists('woocommerceframework_upsell_display')) {
    	function woocommerceframework_upsell_display() {
    	    woocommerce_upsell_display(3,3); // 3 products, 3 columns
    	}
    }

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still - use the pastebin. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

    I'm not great with code so I don't want to start changing stuff, but maybe you can see something here?

  5. darrenhunt
    Member
    Posted 2 years ago #

    Thanks damien19, I ended up doing just that, found it in the theme-woocommerce.php and commented it out, which worked. So only one version showing, which I assume must have something to do with the theme documents.

    In the same boat with code as you!

    No idea how robust my comment would be when it comes to upgrading woo commerce? Maybe someone with a bit ore knowledge may want to suggest a better way, if one exists?

    Thanks again guys

  6. damien19
    Member
    Posted 2 years ago #

    Glad you got it figured out, would you mind sharing the exact code you added and exactly where you added it? I tried adding this:

    .upsells.products {
    display: none;
    }

    in theme-woocommerce.php where the other upsell code is and it crashed the site. I had to go in via FTP and remove it. Do you think you could show me the details of how you did it?

    Thanks in advance if you can take the time to help me out, I know time is valuable.

  7. darrenhunt
    Member
    Posted 2 years ago #

    All I did was comment out the following upsells code in the Mystile - theme/woocommerce.php file. See my comments in place below. So I guess this is the mystile hook, and I know have one upsell section showing which I assume is the woocommerce hook.

    I wasn't bothered which one I turned off as I am not showing the rather random related products either so didn't have to worry whether it was above or below!

    Hope this helps

    /*-----------------------------------------------------------------------------------*/
    /* SINGLE PRODUCTS */
    /*-----------------------------------------------------------------------------------*/
    
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
    add_action( 'woocommerce_after_single_product', 'woocommerce_output_related_products', 20);
    
    if (!function_exists('woocommerce_output_related_products')) {
    	function woocommerce_output_related_products() {
    	    woocommerce_related_products(4,4); // 3 products, 3 columns
    	}
    }
    
    // Upsells
    /*remove_action( 'woocommerce_after_single_product', 'woocommerce_upsell_display');
    add_action( 'woocommerce_after_single_product', 'woocommerce_output_upsells', 20);
    
    if (!function_exists('woocommerce_output_upsells')) {
    	function woocommerce_output_upsells() {
    	    woocommerce_upsell_display(4,4); // Display 3 products in rows of 3
    	}
    }*/
  8. damien19
    Member
    Posted 2 years ago #

    Wow, that was easy, thanks so much for taking the time to explain it to me, worked like a charm.

  9. addesigns
    Member
    Posted 2 years ago #

    Thanks so much for the information! Since you can't get help from the creators, this was very, very useful! Anyone know why the sidebar shows up below the products? That's the next major bug I need to fix :-(

  10. LaCigogne
    Member
    Posted 2 years ago #

    Thank you so much! It worked!

  11. wpShoppingCartReviews.com
    Member
    Posted 2 years ago #

    Hmmm, how odd...I have the exact same problem but no such code snippets exist for me -- and I'm using a free WooThemes theme, too! But it's Wootique....

  12. wpShoppingCartReviews.com
    Member
    Posted 2 years ago #

    Okay, what's finally worked for me is to remove

    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );

    from the woocommerce-hooks.php file...thanks for the "inspiration," guys!

  13. darrenhunt
    Member
    Posted 2 years ago #

    glad we could be of some help ;-)

    Got another problem, it would appear that the custom.css, and probably the mystile 'styles' css isn't being loaded in ie7 & 8. Anyone else come across this problem?

    Thanks

    Darren

  14. nitoone
    Member
    Posted 2 years ago #

    I had the same issue using the abundance theme but rather then removing it from the woocommerce-theme.php I would recommend putting it in the functions.php within your theme so one can still update the plugin like so;

    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
    remove_action( 'woocommerce_single_product_summary', 'avia_woocommerce_output_related_products', 60);

  15. vinsprinter
    Member
    Posted 2 years ago #

    I had the same problem (Using Artificer Free Theme From Woo Commerce) I could not find the file that contained all that code so I used wpShoppingCartReviews.com solution I copied the three add_action snippets of code from the woocommerce-hooks.php file and placed them in the Theme Functions in the editor and it worked like so

    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
    /* add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); */
    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

    I had the third one commented out too for some reason - and the reason for that was that it displays the related products and automatically changes to three different related products on each refresh of the pages. So on second thoughts I have left it in. Thanks Everyone for this information. Now I can move on.

  16. WP-MEC
    Member
    Posted 2 years ago #

    Hi, each product on my product page are showing up twice, what could be the reason and how can i fix this...? any help to resolve this issue is much appreciated. thanks... here is the link to the products page on my site...http://miriamsearthencookware.com/store/

    I am using Woocomerce.

    thanks,

  17. fourwhitesocks
    Member
    Posted 1 year ago #

    I am having the same issue, also using WooCommerce. I see from above posts that this might have something to do with Up-Sells? I don't really know about that (how and where do you define an upsell in WooCommerce; am I accidentally adding an Up Sell??) but all I know is when I add a product, it shows up twice on the Product page and then again down below near the bottom after a line that says: Showing the single result.. so mine are showing up 3 times lol. HELP

    ** I also know that some posters above solved it by editing the Woo commerce-hooks.php file. Won't this get overridden when the Plugin gets updated? I guess I'm looking for the CORRECT way to solve this so nothing gets changed upon any updates :-)

    Just FYI, I pretty much tried adding all the above suggested code and nothing seemed to work for me... any help would be appreciated!

  18. esmi
    Forum Moderator
    Posted 1 year ago #

    @ourwhitesocks: As per the Forum Welcome, please post your own topic.
    http://wordpress.org/support/plugin/woocommerce

    This topic is almost a year old. Closing...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.