【发布时间】:2020-07-13 20:16:39
【问题描述】:
我的代码(我修改并从这里Woocommerce get specific attribute value on cart page 获取)显示了包含属性的完整列表,但我只想使用特定属性,比如说“color1”来生成 SVG 文件。
<?php
$item_data = $cart_item['data'];
$attributes = $item_data->get_attributes();
foreach ( $attributes as $attribute )
{
$out ='';
$out .= $attribute['name'] . ': ';
$out .= $attribute['value'] . '<br />';
echo $out;
}
?>
【问题讨论】:
标签: php wordpress woocommerce