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**

3190 questions
29
votes
8 answers

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', 'woocommerce_clear_cart_url' ); function…
user1370288
  • 909
  • 3
  • 10
  • 20
25
votes
1 answer

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 ( [product_id] => 6803 How do I get the…
Kevin.a
  • 4,094
  • 8
  • 46
  • 82
25
votes
2 answers

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 relative to the item and multiple products can be…
Radley Sustaire
  • 3,382
  • 9
  • 37
  • 48
21
votes
2 answers

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( $cart_object ) { foreach (…
Archana
  • 337
  • 2
  • 4
  • 12
16
votes
8 answers

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. Juste the number of items. I aim to display it over…
Nemzytch
  • 171
  • 1
  • 1
  • 7
16
votes
2 answers

How can I remove Shipping from a WooCommerce cart?

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
  • 181
  • 1
  • 1
  • 6
15
votes
8 answers

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. getSummaryCount() ?> 0): ?>
TheBlackBenzKid
  • 26,324
  • 41
  • 139
  • 209
14
votes
1 answer

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

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 page, with something like…
developerme
  • 1,845
  • 2
  • 15
  • 34
12
votes
2 answers

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 need to select a package. So I selected the…
Ram
  • 319
  • 1
  • 2
  • 16
12
votes
7 answers

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 need it for the particular product.
vivek raj
  • 229
  • 1
  • 3
  • 8
12
votes
4 answers

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
  • 632
  • 2
  • 10
  • 23
11
votes
3 answers

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 the user. Removing the item(s) works, but updating…
Toby Hemmerling
  • 569
  • 1
  • 8
  • 17
11
votes
1 answer

Changing colors for decision tree plot created using export graphviz

I am using scikit's regression tree function and graphviz to generate the wonderful, easy to interpret visuals of some decision trees: dot_data = tree.export_graphviz(Run.reg, out_file=None, feature_names=Xvar, …
June Skeeter
  • 1,142
  • 2
  • 13
  • 27
11
votes
1 answer

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:
helpanoobout
  • 115
  • 1
  • 1
  • 4
11
votes
3 answers

Why is $address->hasCouponCode() always returning null?

For some reason, the magento website does not apply the coupon codes. It always returns an invalid: Coupon code is not valid message. However, strangely enough, this happens when the price of cart is larger then 120 my currency. If I have one…
Fellner Arthur
  • 217
  • 3
  • 17
1
2 3
99 100