问题
I'm trying to work out how to edit the download button link that sits directly underneath the order title, in the order details section of the thank you page.
So if you make an order in Woocommerce, for a product that is downloadable, you get a "Thank you. Your order has been received" box, then under it, you get an "Order Details" box.
In that order details box, it shows each product ordered, and if that product is downloadable, it shows a small "Download: Product name" link under the product title.
I want to hook/filter into that download link, and edit it ( changing the text mainly, but also restyling it).
I've tried finding the action that adds it, but can't seem to work out where it's based, and then how to filter into it to change it's appearance. I did also try to add a function that include a different download link using woocommerce_order_item_meta_end
, then hide the old link, but can't work out how to get the product download link URL either.
Any help would be great, thanks!
回答1:
There doesn't seem to be any filters to do that so you'd need to copy the \templates\order\order-downloads.php
template file into your child theme folder and make modifications to the following line in that file.
case 'download-file':
echo '<a href="' . esc_url( $download['download_url'] ) . '" class="woocommerce-MyAccount-downloads-file button alt">' . esc_html( $download['download_name'] ) . '</a>';
break;
来源:https://stackoverflow.com/questions/48867791/edit-download-link-on-woocommerce-thank-you-page