Edit Download Link on Woocommerce thank you page

被刻印的时光 ゝ 提交于 2020-01-16 16:48:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!