Skip to content

Instantly share code, notes, and snippets.

@imran-khan1
Last active July 5, 2019 05:34
Show Gist options
  • Save imran-khan1/bd2dd69c3e37fed94490db0856f23bfc to your computer and use it in GitHub Desktop.
Save imran-khan1/bd2dd69c3e37fed94490db0856f23bfc to your computer and use it in GitHub Desktop.
<?php
function woo_custom_physical_product_tab( $tabs ) {
global $product;
// Ensure it doesn't show for virtual products
if ( ! $product->is_virtual() ) {
$tabs['shipping'] = array(
'title' => __( 'Shipping', 'textdomain' ),
'callback' => 'woo_custom_shipping_tab',
'priority' => 50,
);
}
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'my_custom_physical_product_tab' );
/**
* Function that displays output for the shipping tab.
*/
function woo_custom_shipping_tab( $slug, $tab ) {
?><h2><?php echo wp_kses_post( $tab['title'] ); ?></h2>
<p>This tab contains shipping information</p><?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment