编辑Woocommerce谢谢页面上的下载链接 [英] Edit Download Link on Woocommerce thank you page

查看:96
本文介绍了编辑Woocommerce谢谢页面上的下载链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找出如何在谢谢"页面的订单详细信息"部分中编辑位于订单标题正下方的下载按钮链接.

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.

因此,如果您在Woocommerce中下订单,对于可下载的产品,您会看到"谢谢.您的订单已收到",然后在其下看到"订单明细"框.

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).

我试图找到添加它的动作,但是似乎无法弄清楚它的基础,然后如何过滤它以改变它的外观.我确实也尝试过使用woocommerce_order_item_meta_end添加包含不同下载链接的功能,然后隐藏旧链接,但也无法弄清楚如何获得产品下载链接URL.

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!

推荐答案

似乎没有任何过滤器可以执行此操作,因此您需要将\templates\order\order-downloads.php模板文件复制到子主题文件夹中并进行修改到该文件的下一行.

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;

这篇关于编辑Woocommerce谢谢页面上的下载链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆