[英]How to change the design for cart item quantity in woocommerce?
我正在研究cart.php模板。 我正在更改設計。 我找不到在哪里可以更改購物車項目數量字段的設計。 例如在單詞數量后添加: 有過濾器woocommerce_cart_item_quantity,但我不知道它可以如何幫助我。 我只是將該字段括入div,僅此而已。
圖片: https : //ibb.co/kfdaW7
woocommerce提供的模板:
<div class="product-quantity delivery" data-title="<?php esc_attr_e( 'Quantity', 'woocommerce' ); ?>">
<?php
if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
} else {
$product_quantity = woocommerce_quantity_input( array(
'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'],
'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0',
'product_name' => $_product->get_name(),
), $_product, false );
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
?>
</div>
過濾器woocommerce_cart_item_quantity()用於呈現數量字段的HTML。 您可以將任何屬性傳遞到此過濾器並修改數量字段。
要更改該字段的標題,請在您共享的代碼的第一行中對其進行更改。
<div class="product-quantity delivery" data-title="<?php esc_attr_e( 'Quantity:', 'woocommerce' ); ?>">
.
.
.
.
.
.
終於我找到了正確的地方。 可以在global / quantity-input.php中進行修改
我不建議編輯插件核心文件。 首次更新后,更改將消失。
我不知道您使用的是哪個主題,HTML的結構是什么,但是對於像您這樣的簡單請求,我建議您使用:: after偽元素。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.