产品类型是可变的。但我不想显示变量描述。
即使产品类型是可变产品,我也想显示产品描述。
如果您看到上传的图片,您就可以理解。
我编辑了 7uc1f3r 代码的一小部分。
有人可以修复以下 7uc1f3r 的代码吗?
function action_woocommerce_before_order_itemmeta( $item_id, $item, $product ) {
// Targeting line items type only
if ( $item->get_type() !== 'line_item' ) return;
// Variable
if ( $product->get_type() == 'variation' ) {
// Get the variable product description
$description = $product->get_description();
} else {
// Get product desciption
$description = $product->get_description();
}
// Isset & NOT empty
if ( isset ( $description ) && ! empty( $description ) ) {
echo $description;
}
}