Skip to main content

Questions tagged [cart]

A web cart or online shopping cart is a web app used to shop online. For questions related to CART -- Classification and Regression Trees -- use the tag [cart-analysis], or consider whether the topic is more appropriate for Cross Validated or Data Science Stack Exchange.

cart
30 votes
8 answers
88k views

How to clear a Woocommerce cart

I am wondering how you can clear the contents of your cart on page load using woocommerce. I came accross how to add a clear cart button using by adding this in to functions.php add_action( 'init', '...
user1370288's user avatar
25 votes
1 answer
66k views

Get in WooCommerce cart the product ID of a cart item

$cart_item = $woocommerce->cart->get_cart(); I have the above code. if I run print_r on cart_item I get a multi dimensional array: Array( [a6292668b36ef412fa3c4102d1311a62] => Array ...
Kevin.a's user avatar
  • 4,236
25 votes
2 answers
51k views

How to retrieve cart_item_data with WooCommerce?

During the add_to_cart function, there is a filter to add "cart item data". The filter is woocommerce_add_cart_item_data. I expected to store my custom plugin data in this, so that the data is stored ...
Radley Sustaire's user avatar
21 votes
2 answers
56k views

Change cart item prices in Woocommerce 3

I am trying to change product price in cart using the following function: add_action( 'woocommerce_before_shipping_calculator', 'add_custom_price' ); function add_custom_price( $...
Archana's user avatar
  • 337
18 votes
8 answers
74k views

Get the number of items in cart in wordpress using woocommerce

i'm actually developping a website. But i'm facing an issue. I need to display the number of item that are in the cart but only the number, nothing else i dont want total amount or anything else. ...
Nemzytch's user avatar
  • 191
16 votes
2 answers
68k views

How can I remove Shipping from a WooCommerce cart? [closed]

I need to remove shipping and shipping calculate from a cart. Is it possible to delete with hooks? The template is: http://flatsome.uxthemes.com/cart/ WooCommerce Cart
Jakub Lang's user avatar
15 votes
8 answers
75k views

Magento - How to get cart items total in header.phtml

I am using Magento eCommerce and I have modified my header.phtml via the Blank template. Code, this is my code but it shows blank. <?php $cartQty = $this->getSummaryCount() ?> <?php ...
TheBlackBenzKid's user avatar
15 votes
1 answer
18k views

GET a coupon code via URL and apply it in WooCommerce Checkout page [closed]

I have a WooCommerce website and when customer add-to-cart a product, it is get redirected to checkout page, so cart page is not accessible. I would like to apply coupon via URL (GET) on checkout ...
developerme's user avatar
  • 1,895
14 votes
2 answers
23k views

Empty cart before add to cart in WooCommerce

I am using WP Job manager with Woo Subscriptions. Now: Initially, I selected a package(Woo Subscription) Then I added all the details. But did not submit it. Came back to the site, so to buy again I ...
Ram's user avatar
  • 337
13 votes
7 answers
21k views

how to get particular product quantity from the cart page in the woocommerce

With this code: foreach ( WC()->cart->get_cart() as $cart_item ) { $quantity = $cart_item['quantity']; echo $quantity; } I can get the quantity of all the products added in cart but I ...
vivek raj's user avatar
  • 239
12 votes
4 answers
30k views

WooCommerce: Check if items are already in cart

I found this great snippet from this website The following is the function to check if a specific product exists in cart: function woo_in_cart($product_id) { global $woocommerce; ...
mysticalghoul's user avatar
12 votes
6 answers
32k views

If cart is empty, the cart page will redirect to shop page in WooCommerce?

In WooCommerce, I want to redirect the cart page to shop page when the cart page is empty otherwise shows the cart page. Can anyone have the solution ? Here is the code I have tried, but it does not ...
Lipsa's user avatar
  • 417
11 votes
3 answers
72k views

Is there any way to display the WooCommerce mini-cart on my WordPress site?

I'm developing a website whereby I would like customers to be able to constantly view the contents of their cart so they can add/remove items on the fly (using WooCommerce). The theme I'm currently ...
jvandervoo's user avatar
11 votes
3 answers
32k views

Magento recalculate cart total in observer

I have an observer that removes items from the cart if they are out of stock (i.e. customer returns to their cart ofter x time, and an item in the cart has gone out of stock), and shows a message to ...
Toby Hemmerling's user avatar
11 votes
1 answer
49k views

woocommerce code for cart button

I need to add the woocommerce cart button to one of my pages and was wondering if someone could help with the code required to call the cart button. Here is the current code: <?php ...
helpanoobout's user avatar

15 30 50 per page
1
2 3 4 5
215