Plugin Contributor
Ewout
(@pomegranate)
Hello Brendavo,
The following code (also mentioned in this thread) should retrieve your custom fields:
<?php
$billing_piegadatajs = get_post_meta($wpo_wcpdf->export->order->id,'_billing_piegadatajs',true);
if (isset($billing_piegadatajs)) {
echo $billing_piegadatajs;
}
?>
Note the leading underscore for the field name in the first line!
The same code can be used for all three fields, just replace the field & variable names.
Thread Starter
Brendavo
(@successful-life)
Hello Ewout.
Thank you very much for your assistance. Your code helped me to get all 3 fields showing up on the invoice.
May i ask how to show the product image in the invoice or slip?
My website will also do wholesale, so i know from experience, that an p-slip or invoice without product images is a very big pain in the ***, if there are dozens of products on it and only names / sku’s.
I would really appreciate it.
With Regards
Glad that you found a solution, Brendavo. I actually checked another plugin with nearly the same name. Thanks for clarifying this, Ewout. I will check your plugin this weekend.
If you have product thumbnails attached (does not work necessarily for variations this way!) you can use something like this, Brendavo:
if ( '' != get_the_post_thumbnail( $id ) ) {
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), $size, false );
$thumburl = $thumb[0];;
echo '<img src="' . $thumburl . '" width="75" height="75" />';
}
For variations with no thumbnail this is a bit different as you have to retrieve the parent thumbnail… The width and height is optional. You can only set the width or you can also use styles attaching a class or the style attribute.
Regards and good luck with your website.
uh
PS on the last post: $id means the product_id in this case which should be available via the cart items listed in the invoice (the cart item id).
Forgot about the $size parameter… if you set it to an desired size like array(75,75) or a predefined thumbnail size identifier you will retrieve your image… Sorry for that. Normally you find the thumbnail predefinitions at the start of your theme’s function file.
uh