Created
November 10, 2020 22:20
-
-
Save smeric/149ee23235d95913974eed3cefb75656 to your computer and use it in GitHub Desktop.
This removes the title entirely to get rid of a duplicate sentence, resolving at the same time a <h2> problem...
This file contains 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 | |
/** | |
* Remove the WooCommerce Local Pickup Time plugin checkout page select field title. | |
* | |
* @see https://github.com/WC-Local-Pickup/woocommerce-local-pickup-time/issues/103 | |
* @see https://github.com/WC-Local-Pickup/woocommerce-local-pickup-time/issues/104 | |
*/ | |
if ( class_exists( 'Local_Pickup_Time' ) ) { | |
// Remove the default local pickup time field from the checkout page. | |
remove_action( apply_filters( 'local_pickup_time_select_location', 'woocommerce_after_order_notes' ), array( Local_Pickup_Time::get_instance(), 'time_select') ); | |
// And add this custom one. | |
add_action( apply_filters( 'local_pickup_time_select_location', 'woocommerce_after_order_notes' ), 'my_custom_time_select' ); | |
/** | |
* Add the local pickup time field to the checkout page | |
* | |
* @param object $checkout The checkout object. | |
*/ | |
function my_custom_time_select( $checkout ) { | |
echo '<div id="local-pickup-time-select">'; | |
$lpt = Local_Pickup_Time::get_instance(); | |
woocommerce_form_field( | |
'local_pickup_time_select', | |
array( | |
'type' => 'select', | |
'class' => array( 'local-pickup-time-select-field form-row-wide' ), | |
'label' => __( 'Pickup Time', 'woocommerce-local-pickup-time' ), | |
'required' => true, | |
'options' => $lpt->build_pickup_time_options(), | |
), | |
$checkout->get_value( 'local_pickup_time_select' ) | |
); | |
echo '</div>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment