Created
January 1, 2022 13:38
-
-
Save tuongpgjz/dd8c8b690f7d43945f3840e565fb0e79 to your computer and use it in GitHub Desktop.
Replace woocommerce product tab with new one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//SalesGen.io | |
//remove reviews and additional_information tab | |
add_filter( 'woocommerce_product_tabs', 'salesgen_remove_product_tabs', 98 ); | |
function salesgen_remove_product_tabs( $tabs ) { | |
if(is_product()){ | |
unset( $tabs['additional_information'] ); // Remove the additional information tab | |
unset( $tabs['reviews'] ); // Remove the additional information tab | |
} | |
return $tabs; | |
} | |
//add more tab with shortcode enable | |
add_filter( 'woocommerce_product_tabs', 'salesgen_new_product_tab' ); | |
function salesgen_new_product_tab( $tabs ) { | |
// Adds the new tab | |
$tabs['shipping_tab'] = array( | |
'title' => __( 'Shipping & Manufacturing Info', 'woocommerce' ), //change the name of tab here | |
'priority' => 10, | |
'callback' => 'salesgen_new_product_shipping_tab_content' | |
); | |
return $tabs; | |
} | |
function salesgen_new_product_shipping_tab_content(){ | |
echo do_shortcode( '[block id="shipping"]' ); //replace block ID by new one in UX Blocks | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment