Skip to content

Instantly share code, notes, and snippets.

@twern
Created September 12, 2017 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twern/11ae57625825447466fb147749872a53 to your computer and use it in GitHub Desktop.
Save twern/11ae57625825447466fb147749872a53 to your computer and use it in GitHub Desktop.
German Market - Filter Polylang Lieferzeit
// 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