{"id":225,"date":"2022-09-08T06:43:58","date_gmt":"2022-09-08T06:43:58","guid":{"rendered":"https:\/\/unmaskwp.com\/?post_type=snippets&p=225"},"modified":"2022-09-08T07:09:17","modified_gmt":"2022-09-08T07:09:17","slug":"how-to-reorder-data-tabs-in-woocommerce-single-product-page","status":"publish","type":"snippets","link":"https:\/\/unmaskwp.com\/snippets\/how-to-reorder-data-tabs-in-woocommerce-single-product-page\/","title":{"rendered":"How to Reorder Data Tabs in WooCommerce Single Product Page?"},"content":{"rendered":"\n
Do you want to change the order of the WooCommerce tabs on the single product page? <\/p>\n\n\n\n
By default, WooCommerce adds three tabs to display related product data. This includes a detailed description of the product, user reviews, and additional information (if any). <\/p>\n\n\n\n
You may want to display these data tabs in a different order on the WooCommerce single page. <\/p>\n\n\n\n
You can use the below code to reorder the data tabs on the single product page in WooCommerce. <\/p>\n\n\n\n
\/**\r\n * Reorder product data tabs\r\n *\/\r\nfunction maverick_reorder_woocommerce_single_product_tabs( $tabs ) {\r\n \r\n \/\/ Set Reviews Tab first\r\n\t$tabs['reviews']['priority'] = 5;\t\t\t\r\n \r\n \/\/ Set Description Tab second\r\n\t$tabs['description']['priority'] = 10;\r\n\t\r\n \/\/ Set Additional information Tab third\r\n $tabs['additional_information']['priority'] = 15;\r\n \r\n\treturn $tabs;\r\n}\r\n\r\nadd_filter( 'woocommerce_product_tabs', 'maverick_reorder_woocommerce_single_product_tabs', 98 );<\/code><\/pre>\n\n\n\n5, 10, and 15 are the priorities assigned to WooCommerce data tabs. If you wish you change the order, you can interchange their priorities. <\/p>\n\n\n\n
For example, if I need additional information first, followed by reviews, followed by the description tab. The code will be revised as the below code. <\/p>\n\n\n\n
\/**\n * Reorder product data tabs\n *\/\nfunction maverick_reorder_woocommerce_single_product_tabs( $tabs ) {\n \n \/\/ Set Reviews Tab first\n\t$tabs['reviews']['priority'] = 10;\t\t\t\n \n \/\/ Set Description Tab second\n\t$tabs['description']['priority'] = 15;\n\t\n \/\/ Set Additional information Tab third\n $tabs['additional_information']['priority'] = 5;\n \n\treturn $tabs;\n}\n\nadd_filter( 'woocommerce_product_tabs', 'maverick_reorder_woocommerce_single_product_tabs', 98 );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"