我想更改计数器购物车,使其显示0为空并删除单词" item"。我在插件woocommerce 3.2.0中使用店面2.2.5模板。负责此代码的文件在哪里?它可能需要在jquery中改变一些东西
答案 0 :(得分:0)
这是执行此操作的功能。档案storefront/inc/woocommerce/storefront-woocommerce-template-functions.php
if ( ! function_exists( 'storefront_cart_link' ) ) {
/**
* Cart Link
* Displayed a link to the cart including the number of items present and the cart total
*
* @return void
* @since 1.0.0
*/
function storefront_cart_link() {
?>
<a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', 'storefront' ); ?>">
<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) );?></span>
</a>
<?php
}
}
您需要在子主题functions.php
文件或plugin
中定义该功能。
希望这有帮助。