Хуки та фільтри

Змінити електронну адресу адміністратора

/**
 * FILTER: bbc_admin_email
 * Description: Retrieves or overrides the administrator email address used for notifications.
 * Params: $mail string
 */

add_filter( 'bbc_admin_email', function( $mail ) {
   $mail = 'no-reply@bazadevelopers.com';
   return $mail;
}, 15, 1 );

Поле «Зробити депозит»

/**
 * FILTER: bbc_set_partial_payment_checked
 * Description: Controls whether the partial payment ("Make a deposit" / 50% vs 100% payment) checkbox is checked by default on the checkout form.
 * Params: $state bool
 * Default value: false
 */

add_filter( 'bbc_set_partial_payment_checked', function( $state ) {
   $state = true;
   return $state;
} );

Змінює розклад певної послуги

/**
 * FILTER: bbc_by_minutes_shift_in_service_schedule
 * Description: Shifts the schedule of a specific service by a given number of minutes in the calendar. Works correctly with full-hour slots as well as split slots. Does not change the service schedule in the admin panel.
 * Params: $minutes int - number of minutes, $service_id int - ID of the selected service
 */
add_filter( 'bbc_by_minutes_shift_in_service_schedule', 'shift_the_working_day', 99, 2 );

function shift_the_working_day( $minutes, $service_id ) {
   if( 36 == $service_id ) {
       $minutes = 15;
   }
   return $minutes;
}

Встановлює мінімальний часовий інтервал (у секундах)

/**
 * FILTER: bbc_minimum_time_to_enable_slots
 * Description: Sets the minimum time interval (in seconds) from "now" to the nearest available booking slot.
 * Params: $seconds int - number of seconds
 * Default value: 0
 */
add_filter( 'bbc_minimum_time_to_enable_slots', function( $seconds ) {
   $seconds = 1*60*60;
   return $seconds;
}, 10, 1 );

Змінити кнопки навігації в календарі

Цей фільтр дозволяє оформлювати або змінювати вигляд кнопок навігації календаря. Використовуйте його, щоб додавати власні елементи оформлення, заголовки або додатковий вміст навколо кнопок навігації. Безперебійно працює з оновленнями календаря за допомогою AJAX.

/**
 * FILTER: bbc_calendar_navigate_buttons
 */

// Custom BBC header
add_filter( 'bbc_calendar_navigate_buttons', function( $html ) {
    array_unshift( $html, [
        'selector' => 'h3',
        'classes'  => [ 'calendar-header-title' => true ],
        'content'  => __( 'Select Your Time', 'bazadev' ) . 
                      '<span>' . __( 'Discounts apply for bookings of 3 hours or more.', 'bazadev' ) . '</span>',
    ]);

    return [
        [
            'selector' => 'div',
            'classes'  => [ 'calendar-buttons-wrapper' => true ],
            'children' => $html,
        ]
    ];
}, 10, 1 );

// Custom BBC button text
add_filter( 'bbc_calendar_button_prev_text', function( $text ) {
    return '<span class="button-text">' . __( 'Previous', 'bazadev' ) . '</span>';
});

// Custom BBC button text
add_filter( 'bbc_calendar_button_next_text', function( $text ) {
    return '<span class="button-text">' . __( 'Next', 'bazadev' ) . '</span>';
});

Фільтри налаштування календаря та форм

/**
 * BBC Calendar and Form Filters Documentation
 */

// Add content before the entire form
add_filter( 'bbc_outside_before_form', function( $content ) {
    $content .= '<div class="booking-promo-banner">
        <h2>Special Offer: 20% Off This Week!</h2>
    </div>';
    return $content;
});

// Replace content after the entire form
add_filter( 'bbc_outside_after_form', function( $content ) {
    $content = '<div class="booking-promo-banner">
        <h2>Special Offer: 20% Off This Week!</h2>
    </div>';
    return $content;
});

// Add content before the booking form block
add_filter( 'bbc_before_booking_form', function( $content ) {
    $content .= '<p class="booking-note">Please fill in all required fields carefully.</p>';
    return $content;
});

// Add content after the booking form block
add_filter( 'bbc_after_booking_form', function( $content ) {
    $content .= '<p class="booking-note">Thank you for booking with us!</p>';
    return $content;
});

// Add content before the submit button
add_filter( 'bbc_before_submit_button', function( $content ) {
    $content .= '<p class="submit-note">Make sure all information is correct before submitting.</p>';
    return $content;
});

// Add content after the submit button
add_filter( 'bbc_after_submit_button', function( $content ) {
    $content .= '<p class="submit-note">You will receive a confirmation email shortly after submitting.</p>';
    return $content;
});

// Add content inside the form, before main fields
add_filter( 'bbc_inside_before_form', function( $content ) {
    $content .= '<div class="form-intro">
        <p>Please select your preferred time slots below:</p>
    </div>';
    return $content;
});

// Add content inside the form, after main fields
add_filter( 'bbc_inside_after_form', function( $content ) {
    $content .= '<div class="form-footer-note">
        <p>Need help? Contact our support team for assistance.</p>
    </div>';
    return $content;
});

// Add content before additional services button
add_filter( 'bbc_before_additional_services_button', function( $content ) {
    $content .= '<div class="bbc-before-additional-services-button">
        <p>Before additional services button text.</p>
    </div>';
    return $content;
});

// Add content after additional services button
add_filter( 'bbc_after_additional_services_button', function( $content ) {
    $content .= '<div class="bbc-after-additional-services-button">
        <p>After additional services button text.</p>
    </div>';
    return $content;
});

// Change "Get payment link" text
add_filter( 'bbc_form_checkbox_get_payment_url_text', function( $text ) {
    return __( 'Send payment link to email', 'your-theme' );
});

// Change "Request invoice" text
add_filter( 'bbc_form_checkbox_request_invoice_text', function( $text ) {
    return __( 'I need an invoice', 'your-theme' );
});

// Change partial payment text
add_filter( 'bbc_form_checkbox_partial_payment_text', function( $text ) {
    return __( 'Pay deposit only', 'your-theme' );
});

// Change submit button text
add_filter( 'bbc_form_submit_button_text', function( $text ) {
    return __( 'Confirm booking', 'your-theme' );
});

// Change accept terms text
add_filter( 'bbc_form_accept_terms_text', function( $text ) {
    return __( 'I confirm I have read the booking', 'your-theme' );
});

// Change accept terms link text
add_filter( 'bbc_form_accept_terms_link_text', function( $text ) {
    return __( 'Rules', 'your-theme' );
});

// Change "Include in price" text for additional services
add_filter( 'bbc_additional_service_include_in_price_text', function( $text ) {
    return __( 'Included in total', 'your-theme' );
});

// Change currency symbol
add_filter( 'bbc_get_currency_symbol', function( $symbol ) {
    $lang = pll_current_language();
    
    $currencies = [
        'af' => 'R',
        'sq' => 'L',
        'ar' => '﷼',
        'hy' => '֏',
        'az' => '₼',
        'eu' => '€',
        'be' => 'Br',
        'bs' => 'KM',
        'bg' => 'лв',
        'ca' => '€',
        'zh' => '¥',
        'hr' => '€',
        'cs' => 'Kč',
        'da' => 'kr',
        'nl' => '€',
        'en' => '$',
        'et' => '€',
        'fi' => '€',
        'fr' => '€',
        'ka' => '₾',
        'de' => '€',
        'el' => '€',
        'he' => '₪',
        'hi' => '₹',
        'hu' => 'Ft',
        'is' => 'kr',
        'id' => 'Rp',
        'it' => '€',
        'ja' => '¥',
        'kk' => '₸',
        'ko' => '₩',
        'lv' => '€',
        'lt' => '€',
        'mk' => 'ден',
        'ms' => 'RM',
        'mt' => '€',
        'nb' => 'kr',
        'fa' => '﷼',
        'pl' => 'zł',
        'pt' => '€',
        'ro' => 'lei',
        'ru' => '₽',
        'sr' => 'din',
        'sk' => '€',
        'sl' => '€',
        'es' => '€',
        'sv' => 'kr',
        'th' => '฿',
        'tr' => '₺',
        'ua' => '₴',
        'ur' => '₨',
        'uz' => 'so'm',
        'vi' => '₫',
    ];
    
    return $currencies[$lang] ?? $symbol;
});
Востаннє змінено: 05.09.2026