Skip to content

Commit

Permalink
Add WC Bookings Support. Fixes issue #20
Browse files Browse the repository at this point in the history
  • Loading branch information
bernattorras committed Apr 21, 2021
1 parent 1ea51fe commit 31236b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions woocommerce-subscriptions-custom-pricestring.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
$variations_hook = 'woocommerce_variable_product_before_variations';
}

if ( class_exists( 'WC_Bookings' ) ) {
// WooCommerce Bookings is enabled -> Add the custom from string field in the "Advanced" tab.
add_action( 'woocommerce_product_options_advanced', 'wcs_cps_from_field' );
}

/**
* Adds the 'Custom Price String' field to the product editor page.
*
Expand Down Expand Up @@ -302,6 +307,7 @@ function wcs_cps_from_string( $price, $product ) {
$target_product_types = array(
'variable',
'variable-subscription',
'booking',
);

if ( in_array( $product->get_type(), $target_product_types ) ) {
Expand Down

0 comments on commit 31236b8

Please sign in to comment.