【发布时间】:2020-06-14 14:58:25
【问题描述】:
我正在尝试了解如何在结帐页面上添加数量输入字段,从而允许客户更改每种产品的数量。
这是我目前得到的:
add_filter( 'woocommerce_checkout_cart_item_quantity', 'qty_and_qty_change_on_checkout', 20, 3 );
function qty_and_qty_change_on_checkout( $quantity_html, $cart_item, $cart_item_key ) {
return '<br>
'.woocommerce_quantity_input().'
<span class="product-quantity">
' . sprintf( '<b>Qty:</b> %s', $cart_item['quantity'] ) . '
</span>';
}
但这给了我一个错误,即使woocommerce_quantity_input() 是它的官方功能? 错误是:
Notice: Undefined index: product in /wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1670
【问题讨论】:
标签: php wordpress woocommerce checkout product-quantity