You’re passing two parameters to _n
function, the first one is the pattern for one item, and the second for 2 or more. Just change the pattern.
Show only numbers:
<?php echo sprintf (_n( '%d', '%d',count( WC()->cart->get_cart())),count( WC()->cart->get_cart())); ?>
Show item
for two or more:
<?php echo sprintf (_n( '%d', '%d items',count( WC()->cart->get_cart())),count( WC()->cart->get_cart())); ?>
For more information check here.
But, if you want to show only the number, you could echo the cart count directly:
echo count( WC()->cart->get_cart());
or
echo WC()->cart->get_cart_contents_count();
Related Posts:
- How to override WooCommerce template files?
- WooCommerce get physical store address
- Woo-commerce | Disable proceed to checkout button in cart page if total in cart less than 15 [closed]
- WordPress query through Products variation stock [closed]
- How can I override these WooCommerce widget cart button functions
- Programatically update Custom Attributes WooCommerce
- How to update variable product stock status with code
- Editing Header Titles of each details in woocommerce Order Email [closed]
- Following migration from DEV to LIVE, woocommerce can’t checkout
- is_user_logged_in() always returns false for woocommerce_login_redirect
- How to change a column width on WooCommerce orders page (Admin)
- WooCommerce Shop Orders by Date
- Show list of woo commerce orders where particular zip code exists using pre_get_posts?
- Woocommerce Shipping label just hangs
- adding a script with type=”module” to woocommerce admin area
- Redirect customer to login page (with other signup plugin) if user not logged in when proceeding to checkout
- Featured image for product listings, but another image as the product image?
- How to add custom data to cart for a specific product which I have shown on a page programmatically and with a separate anchor adding it to cart?
- How to select from two different tables to display orders list with custom column from other table
- Keep getting Notice: Trying to get property of non-object in …\wp-includes\post.php on line 4153 when generating woocommerce coupon
- How to subscribe free subscription on user registration in woocommerce subscription plugin?
- Woo Related Products How to override the plugin script?
- Woocommerce how to alter shipping tax before checkout
- Woocommerce cart page – Add “Free” to the shipping label when shipping is 0
- Line break on Product details [closed]
- WooCommerce add class name in the list [closed]
- How to display Woocommerce variations prices and descriptions
- How to override the title tag for woocommerce endpoints?
- Adding Transaction-Specific Conversion Tracking from Adwords into WooCommerce
- New field on checkout is shown but it’s not saved on the order details [closed]
- How to rewrite product permalinks in Woocommerce to use category slugs
- How to re-arrange this hooked content?
- Pre filter woocommerce products to remove a certain category of products
- Woocommerce altered my homepage, and I can’t figure out how to revert it [closed]
- Woocommerce – Problem sorting and filtering products with different tax rates by price [closed]
- Why does my loop breaks the css below?
- How to add order status class to the body tag?
- Woocommerce – Change the template?
- Wooocommerce disable check_cart_item_stock if cart item has specific meta
- Force meta data on specific product type
- WooCommerce plaintext mail doesn’t display currency symbol
- WP/WooCommerce multisite with polylang, product duplication between websites [closed]
- WooCommerce add_to_cart
- Show password while you are typing it on the “my account” login page
- Functions.php change for Woocommerce not working
- Woocommerce replace product page image with product tabs [closed]
- Woocommerce – How to mix products and posts on a landing page?
- Disable woocommerce product search plugin’s autocomplete [closed]
- Add Attribute to Woocommerce programatically, doesn’t display front end [closed]
- Woocommerce – Add additional item if some item wants to be added to the cart?
- Hook “wp_trash_post” executing multiple time in case of bulk trash products
- WooCommerce Subscriptions: Hide one variation subscription
- Contact form 7 send product PDF after submit
- Add sub variations in product page
- Woo commerce product quantity wise SKU
- Override une fonction dans une class Woocommerce
- What to do if images are not displayed in mob. versions of the online store on wordpress?
- WooCommerce (Bookings) + AddOns not always calculating correctly the total
- Woocommerce order proceed hooks
- List of JS events in the WooCommerce frontend
- WooCommerce custom product type not saving with namespaces
- Add shortcode to show woocommerce shipping class name on product template
- Redirecting orders by company field
- Upload file to Woocommerce Order
- wp_login overriding user meta data
- Split taxonomies on different pages
- woocommerce REST api on the website’s front-end
- Woocommerce List categories with Image thumbnail
- How to add (and change the font of) the short product description to order page and customer’s new order e-mail [closed]
- Display WOO Commerce products on HTML page?
- How to add custom text field inputs for attributes in backend?
- Get unsolved array keys of product data tabs in woo product editor page
- Show products as posts on archive page
- Woocommerce new shop page
- Add class to latest item Woocommerce
- Disable theme WooCommerce template [closed]
- WooCommerce: how to set stock per attribute on variable product
- How to display products in sidebar in 2 columns?
- Replace “Add to cart” by a link to contact page on specific product
- Adding price to woocommerce cart item with get_price gets multiplied with 3?
- Increase load-out-page speed
- WooCommerce Stucked (?) – Edit dimensions
- Use Product Attribute in conditional tag
- Admin – Custom Post Type in WooCommerce menu – how to control menu order
- Facing issue in Woocommerce 3.3 version in wordpress
- getting attributes in a product loop
- How to add a fixed shopping cart button on the bottom of the page?
- Update products, terms and relations via SQL
- How to Display Amount of products being displayed out of the amount in category – WordPress/Woocommerce
- How to programatically create a WooCommerce downloadable product?
- Echo SKU in WooCommerce Conformation page [closed]
- Custom sender email address for specific WooCommerce product
- Woocommerce cart displays outdated prices [closed]
- Adding Extra Customer Email In Woocommerce Checkout
- How to override email text New Customer Order?
- How do I create a array custom field for use with facetwp.com?
- How to add my theme’s style to woocommerce blocks?
- Get a customer’s phone number by woocommerce
- Insert a custom field as a second email address to a completed order in WooCommerce
- Want to add Number of Products added by each shop manager in users list