【发布时间】:2021-06-19 16:55:01
【问题描述】:
我正在尝试将产品下载 url 更改为管理员输入的自定义 url。我已经使用下面的代码在单个产品页面上完成了此操作。但它在“下载”页面中不起作用。我尝试更新 order_download.php 文件中的代码,但没有响应。
// Declaring $product variable from woocommerce, this isn't needed if previously declared
global $product;
// get all downloadable files from the product
$files = $product->get_files();
echo "<style>.elementor-widget-jet-single-add-to-cart > div > div > form{display:none;}</style>";
//Loop through each downloadable file
foreach( $files as $file ) {
$new_url = $file['file'];
//store the html with link and name in $output variable assuming the $output variable is declared above
$links_html .= "<a class='{$classes}' href='{$new_url}' data-key='{$key}' target='_blank' data-product-id='{$id}'>{$name}</a>";
}
【问题讨论】:
标签: php wordpress woocommerce plugins