Wie fügt man benutzerdefinierte Daten in die PDF-Datei WooCommerce-Produkte ein?
Wenn Sie einige benutzerdefinierte Daten wie Post-Meta oder ähnliches hinzufügen/anzeigen möchten, können Sie einen unserer Hooks verwenden. Ein Beispiel:
add_filter( 'woocommerce_pdf_catalog_before_product_information_categories', 'show_case_pack_in_pdf', 10, 2); Funktion show_case_pack_in_pdf ($html, $id) { $Produkt=wc_get_Produkt($id); $pid= $Produkt->get_id(); $case_pack=get_post_meta($pid,'case_pack',true); $html='Case Pack: ' . $Koffer_Packung;$html zurückgeben; }
Fragen & Antworten (4)
Tahir31. Juli 2020
Hi,
This is a very nice feature.
“Show Product Attributes” shows all when enabled.
Can only “Attributes> Battery Capacity” be displayed with this code?
best regards,
Tahir
Daniel Barenkamp31. Juli 2020
Yes correct!
Jenny8. März 2020
Hi there, I have just purchased this product and am loving it. I just want to know how to change the button text from “Category Catalogue” to just “Catalogue”. I also want to be able to add one attribute (which is author) so I can tell who made which paintings. Can you help?
thanks so much, Jenny
WeLaunch8. März 2020
Hi Jenny, you can change the text with loco translate for example. Adding a custom field called author requires you to use our hooks inside the plugin. We can customize / add this feature for you, contact our customization service at [email protected]