soflyy / oxygen-bugs-and-features

Bug Reports & Feature Requests for Oxygen
https://oxygenbuilder.com/
315 stars 30 forks source link

Add Cart Count to Woo Components #655

Open wplit opened 4 years ago

wplit commented 4 years ago

Describe the feature you'd like to see included in Oxygen. You've added Cart Total as a new component, which is great, but I find cart count is more commonly used in headers.

What are the use cases for this feature? A lot of ecommerce sites have a cart icon in the header showing the number of items in the cart. After clicking you then go to the cart.

The code is pretty identical to what you've added for the cart total component, just replace

WC()->cart->get_cart_total() with WC()->cart->get_cart_contents_count()

You may also want to add the option to make these elements links to the cart with a dynamic link (and maybe include an icon so it's even easier to build a typical cart icon for headers)

<a href="<?php echo WC()->cart->get_cart_url(); ?> </a>

wkoehn commented 4 years ago

One cool bit of functionality in a recent plugin I used was the option to redirect to shop page if the cart is clicked when the cart is empty.

adrien-robert commented 4 years ago

+1, easy implementation but nice component

shmaltz commented 3 years ago

811