I’m trying to show a link to a file which is uploaded on an order page through an ACF field but it doesn’t seem to work, I have a file upload field on WooCommerce order-posts and can show the link to the file in order emails by using;
<?php if(get_field('video')): ?>
<h2><a href="<?php the_field('video'); ?>">DOWNLOAD HERE</a></h2>
<?php else: ?>
// SOMETHING ELSE
<?php endif; ?>
but if I use this code on the order details page which the user can see through “My Account” it doesn’t work – the code for the order page is here https://github.com/woothemes/woocommerce/blob/master/templates/order/order-details.php
How can I display the link required?
Thank you!
I don’t supposed you ever found a solution to this did you?
I’m having the same issue!
Thanks
I finally found a solution to this.
I needed to have a DHL number in my orders page – so when I shipped the order, I put in the DHL number in that field and it should show up in the order.
That’s how I did it in my functions.php:
add_action ('woocommerce_order_details_after_order_table', 'optigem_sendungsnummer', 20);
function optigem_sendungsnummer( $order ) {
if (get_field('sendungsnummer', $order->id)) { // Only show if field is filled
?>
<p class="sendungsnummer">DHL: <?php the_field('sendungsnummer', $order->id); ?><p>
<?php
}
}
Hi zaehlpixel,
I use the same code than you for my woocommerce store.
The problem is that I have to add the DHL tracking code, hit save, then mark the order as complete and save again.
If I just change the status to order complete, add the tracking number, hit save, it won’t include the tracking number in the order completion email.
Have you experienced the same issue?