【发布时间】:2015-01-12 10:37:49
【问题描述】:
我已经使用了我在Short Description in checkout woocommerce wordpress 找到的 brasofilo 提供的解决方案。
但由于某种原因,每个产品的每个描述后都会添加一个冒号。
我使用萤火虫试图找出它可能来自哪里。它显示在结帐页面上显示的每个产品的 dt class="variation-Productdescription" 的末尾。这是我从 firebug 复制的代码:
<tbody>
<tr class="cart_item">
<td class="product-name">
<a href="http://shopurl/product/Product1/">Product1</a>
<strong class="product-quantity">× 1</strong>
<dl class="variation">
<dt class="variation-Productdescription">
<div class="post-content">
:
</dt>
<dd class="variation-Productdescription></dd>
</dl>
</td>
<td class="product-total">
</tr>
<tr class="cart_item">
</tbody>
编辑:
我是新手,这里还不能上传图片,所以我把问题截图上传到http://i.imgur.com/HMh8A3P.jpg?1
产品简短描述没有冒号。
A Screenshot of the Product Short Description
编辑 2:
目前对我有用的解决方案是:
add_filter( 'woocommerce_get_item_data', 'wc_checkout_description_so_27900033', 10, 2 );
function wc_checkout_description_so_27900033( $other_data, $cart_item )
{
$post_data = get_post( $cart_item['product_id'] );
echo $post_data->post_excerpt;
return $other_data;
}
但正如 helgatheviking 所指出的,这不是一个好的解决方案,即使它有效。
我会在没有echo 的情况下找到更好的解决方案。
【问题讨论】:
-
你能通过屏幕截图向我们展示输出吗?
标签: php wordpress woocommerce