Created
September 12, 2017 07:50
-
-
Save twern/11ae57625825447466fb147749872a53 to your computer and use it in GitHub Desktop.
German Market - Filter Polylang Lieferzeit
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
// Fix problem with polylang for delivery times of German Market | |
add_filter( 'woocommerce_de_get_deliverytime_string_label_string', 'my_woocommerce_de_get_deliverytime_string_label_string' ); | |
function my_woocommerce_de_get_deliverytime_string_label_string( $product ) { | |
$term_id = WGM_Template::get_term_id_from_product_meta( '_lieferzeit', $product ); | |
if ( (int) $term_id == - 1 || empty( $term_id ) ) { | |
$term_id = get_option( WGM_Helper::get_wgm_option( 'global_lieferzeit' ) ); | |
} | |
$label_term = get_term( $term_id, 'product_delivery_times' ); | |
if ( is_wp_error( $label_term ) || ! isset( $label_term ) ) { | |
$label_string = __( 'not specified', 'woocommerce-german-market' ); | |
} else { | |
$label_string = $label_term->name; | |
} | |
return $label_string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment