Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save woogists/96fa3e8afda6fb73ca3536313fe88bfc to your computer and use it in GitHub Desktop.
Save woogists/96fa3e8afda6fb73ca3536313fe88bfc to your computer and use it in GitHub Desktop.
[WooCommerce Bookings] - Product Dependencies
/**
* Will make it so the Dependencies tab shows on a Bookable product.
*
* @param array $tabs The list of tabs in a product's settings.
*/
function add_bookable_product_to_dependencies( $tabs ) {
// Check to see if the class exists and if the tab is set.
if ( class_exists( 'WC_Product_Dependencies' ) && isset( $tabs['dependencies'] ) ) {
// If so, add our class for the JS hooks.
$tabs['dependencies']['class'][] = 'show_if_booking';
}
return $tabs;
}
add_filter( 'woocommerce_product_data_tabs', 'add_bookable_product_to_dependencies', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment