我有一个使用WP_Query循环遍历产品post类型的函数。在此函数中,我可以从post对象中获取产品post的固定链接、标题、图像等内容。但是,对于循环中的每个产品,我需要访问产品对象,因为我想要计算和显示评论评分。我使用全局$product和$product-> get _rating_count()等来获取所需的数据。但是,在调试另一段代码时,我发现众所周知的“ID被错误调用。不应直接访问产品属性”。此函数出错。 一切仍然有效(关闭了调试),但我想确保它在未来的WooCommerce版本中仍然有效。有人知道我可以从一个WP_Query循环(循环遍历产品post类型)访问产品对象属
我已经做了一个过滤器来更新在woocommerce上显示订单的方式。基本上,我需要店主能够点击每个产品的名称(现在链接到特征图像),也需要他能够看到URL (因为图像文件名对他们跟踪产品很有用)。
我需要它只影响发送给店主的新订单电子邮件.
我的代码放置在functions.php确实更新,但在所有电子邮件和订单确认表在网站上。
有问题吗?我如何才能只影响新的订单电子邮件?我想我漏掉了什么东西。
// item name link to product
add_filter( 'woocommerce_order_item_name', 'display_produc
我已经添加了一个新的自定义链接的产品字段下“向上销售”在Woocommerce管理部分。
我使用了以下代码(归功于TheYaXxE):
// Display the custom fields in the "Linked Products" section
add_action( 'woocommerce_product_options_related', 'woocom_linked_products_data_custom_field' );
// Save to custom fields
add_action( 'woocom
我在我的functions.php中找到了一个代码,该代码为"instock“组织我的产品,最后"outstock”也很好,但是我有1000多个产品,一些产品有一个通用的映像,因为它们没有产品的图像,这称为"no2.png",我需要按库存组织我的产品,并且没有"no2.png“的一般映像。
class iWC_Orderby_Stock_Status
{
public function __construct()
{
// Check if WooCommerce is active
if (in_arra
我一直试图添加一个产品缩略图链接到产品的客户最近的订单页面,我的帐户在woocommerce。由于阿南德在这里提出了这个问题:,我成功地将图像缩略图放在了适当的位置,但现在我开始怀疑如何让这个拇指成为链接到实际产品的永久链接。
所以我知道这是让图像缩略图就位的代码:
<?php
// Get a list of all items that belong to the order
$products = $order->get_items();
// Loop through the items and get the product image