This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'wc_tickets_your_event_tickets', function( $string ) { | |
| return 'Votre billet d\'événement'; | |
| } ); | |
| add_filter( 'wc_tickets_ticket_is_ready_content', function( $string ) { | |
| return 'Vos billets sont prêts ! Vous pouvez les imprimer ou les afficher sur votre appareil mobile lors de l\'événement.'; | |
| } ); | |
| add_filter( 'wc_ticket_ticket_code', function( $string ) { | |
| return 'Code du billet :'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Adding the meta data to the Google Event Description | |
| * | |
| * @param string $description Event Description. | |
| * @param obj $app Objection of all information for the calculation. | |
| */ | |
| function bkap_google_event_description_callback( $description, $app ) { | |
| $item_id = $app->item_id; | |
| $item = new WC_Order_Item_Product( $item_id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * WooCommerce Custom Item Meta Data with Edit Functionality | |
| * Compatible with both classic and block-based cart/checkout | |
| */ | |
| // 1. Add custom field on product page | |
| add_action('woocommerce_before_add_to_cart_button', 'add_custom_name_field'); | |
| function add_custom_name_field() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Deletes a batch of old bookings (older than 2 years) | |
| * Returns true if more bookings remain, false if completed. | |
| */ | |
| function bkap_delete_old_booking_batch( $batch_size = 200 ) { | |
| global $wpdb; | |
| $two_years_ago = gmdate( 'YmdHis', strtotime( '-3 years' ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('woocommerce_cart_calculate_fees', 'discount_after_first_night', 20, 1); | |
| function discount_after_first_night($cart) { | |
| if (is_admin() && !defined('DOING_AJAX')) return; | |
| $total_discount = 0; | |
| foreach ($cart->get_cart() as $cart_item) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Modify sorting pattern for size attribute. | |
| */ | |
| function swpco_weekdays() { | |
| /* Following data is assumption that you want the size order in mentioned order. */ | |
| return array( | |
| 's' => 'aaaaaaaaa', | |
| 'm' => 'aaaaaaaab', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add a custom field to the General tab on the product edit page | |
| add_action( 'woocommerce_product_options_general_product_data', 'add_custom_price_option' ); | |
| function add_custom_price_option() { | |
| woocommerce_wp_text_input( | |
| array( | |
| 'id' => '_custom_price_title', | |
| 'label' => __( 'Display Price', 'your-textdomain' ), | |
| 'description' => __( 'Enter a custom price title to display on the product page.', 'your-textdomain' ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function bkap_show_booking_price_with_tax( $wp_send_json, $product_id ) { | |
| if ( 'yes' !== get_option( 'woocommerce_calc_taxes' ) ) { | |
| return $wp_send_json; | |
| } | |
| $product_obj = wc_get_product( $product_id ); | |
| $total_price = $wp_send_json['total_price_calculated']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function bkap_booking_reminder_add_cc_bcc( $headers, $email_id, $order ) { | |
| if ( 'bkap_booking_reminder' == $email_id ) { | |
| $admin_email = get_option( 'admin_email' ); | |
| $headers .= "Bcc: Admin <" . $admin_email . ">\r\n"; | |
| } | |
| return $headers; | |
| } | |
| add_filter( 'woocommerce_email_headers', 'bkap_booking_reminder_add_cc_bcc', 9999, 3 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function bkap_date_from_session_cookie( $date ) { | |
| if ( $date ) { | |
| if ( str_contains( $date, '/' ) ) { | |
| $d = DateTime::createFromFormat( 'j/n/y', $date ); | |
| $date = $d->format( 'Y-m-d' ); | |
| } | |
| } | |
| return $date; |
NewerOlder