Example: baschtuegge.ch project.
// GERMANIZED INVOICES
add_filter( 'storeabill_packing_slip_shortcodes', function( $shortcodes, $shortcode_instance ) {
$shortcodes['get_data_abholung_custom_shortcode'] = function( $atts, $content = '' ) use ( $shortcode_instance ) {
$document = $shortcode_instance->get_document();
$result = "";
$get_order_id = $document->get_order_id();
// $get_order_id = 62483;
if(get_field("abholdatum", $get_order_id)){
$result .= "<span>".__("Tag der Abholung: ", "tzn").get_field("abholdatum", $get_order_id)."</span><br>";
}
if(get_field("additional_abholung", $get_order_id)){
$result .= "<span>".__("Uhrzeit der Abholung: ", "tzn").get_field("additional_abholung", $get_order_id)."</span><br>";
}
if(get_field("additional_phone", $get_order_id)){
$result .= "<span>".__("Telefon: ", "tzn").get_field("additional_phone", $get_order_id)."</span><br><br>";
}
if(get_field("additional_kommentar_zur_abholung", $get_order_id)){
$result .= "<span>".__("Kommentar zur Abholung: ", "tzn").get_field("additional_kommentar_zur_abholung", $get_order_id)."</span><br>";
}
return $result;
};
return $shortcodes;
}, 10, 2 );