WordPress.org

Forums

WooCommerce - excelling eCommerce
[resolved] Changing the order of things displayed on product page (6 posts)

  1. Troy Templeman
    Member
    Posted 1 year ago #

    I'm trying to change the order of how some things are displayed on my single product page (i.e. move picture under title, move price to bottom, etc.). I understand that woocommerce uses hooks to make this proceess easier but I'm not very familar with hooks and documentation doesn't make this very clear for hook beginners. I've already copied the template to my theme folder but need to know how to edit it in order to make some changes o the order. Can someone point me in the right direction?

    Thanks!

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

  2. terrytsang
    Member
    Posted 1 year ago #

    Hi @troytempleman, you can open "woocommerce-hooks.php" file at wp-content/plugins/woocommerce/ folder. Search for "Single Products" word...

    You can change the display order of single product summary (title, price, short description) by put the code into functions.php in your theme folder and change the number (5, 10, 20) for below example.

    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );

    Hope it will help. You can see more hooks at the file and overwrite them at your theme functions.php.

  3. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    Remember to unhook the functions first ;-)

  4. Troy Templeman
    Member
    Posted 1 year ago #

    Thanks @terrysang! @jameskoster how do you unhook them?

  5. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    With remove_action();.

    So:

    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
  6. Troy Templeman
    Member
    Posted 1 year ago #

    Awesome, thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic