Change the Order of the Product Tabs in Woocommerce
Filed in Tutorials & Resources
Another super quick solution to a really annoying problem. I’ve never liked the short vs long description supplied out of the box with Woocommerce. Honestly I’ve never had the need for it – I nearly always leave the long description blank and have all the relevant information in the short description. That then typically leaves me with two more tabs – the attributes tab (often just a bunch of information from my product variations) and the reviews tab. Depending on your product, and how well it’s been received of course, you may want to switch the user reviews tab to be the first default open tab.
Open up functions.php in your theme files and add the following code. The numbers 10,20,30 in the second part refer to the order the tabs will be rendered, so placing 10 next to an item will render that one first, and 30 last.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | add_action( 'wp' , 'wc_order_tabs' ); function wc_order_tabs() { // Remove tabs remove_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 ); remove_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 ); remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 ); // Re-hook with different priorities. See the final args (10, 20, 30) - thats the order they get rendered. add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 20 ); add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 30 ); add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 10 ); } |
Happy coding! 🙂
Based in London, Working Everywhere
I’m a Freelance Web Designer and WordPress developer, I’m based in London but work with client’s in the UK and all over the world.
how can i remove specification