Break up Related Products from Product Data Tabs (4 posts)

  1. ameraz
    Posted 3 years ago #

    I'm trying to modify the markup so the single product page meets the desired design.

    I want to break up the Related Products from the Product Data Tabs.
    Both are being called -one after another- with the woocommerce_after_single_product_summary hook.

    Basically, I want to output each one wherever I need it and wrap it with whatever I want to.

    Is there any way to call them separetely?

    Any help will be very much appreciated.


  2. James Koster
    Plugin Author

    Posted 3 years ago #

    Hi there,

    Not really sure what you mean. They are called separately. If you want to move one component then unhook it from woocommerce_after_single_product_summary then hook it back into a more appropriate action. You can see a list of template hooks in woocommerce-hooks.php.

    To edit markup you will need to edit the template files directly. If you edit a template, please be sure to copy it to your theme so you're safe when you upgrade. You can read about how to do that here; http://docs.woothemes.com/document/template-structure/

    Thanks, Jay

  3. ameraz
    Posted 3 years ago #

    Thanks very much for your help Jay, can you help me with a little sample code on how to unhook and hook it back again?

    Maybe that's my problem, I have tried something like this with no success:

    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

    ... and then call it back again:

    do_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

  4. Roy Ho
    Posted 3 years ago #

    @ameraz - you need to use add_action() and add it to the hook you want it to show.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic