Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[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