Skip to content

Instantly share code, notes, and snippets.

@tuongpgjz
Created January 1, 2022 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuongpgjz/dd8c8b690f7d43945f3840e565fb0e79 to your computer and use it in GitHub Desktop.
Save tuongpgjz/dd8c8b690f7d43945f3840e565fb0e79 to your computer and use it in GitHub Desktop.
Replace woocommerce product tab with new one
<?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