Woocommerce cart items discount gets reset in checkout

I’ve been trying to implement a discount in my store with the following code: add_action(‘woocommerce_before_calculate_totals’, ‘set_discount’, 10 ); function set_discount( $cart ) { if ( …

Make WC_Cart add_to_cart method working for guests in Woocommerce

Im trying to get my code to work. Searching for hours now. I found similar questions like this one. But unfortunately noone seems to find a solution. In my custom plugin I want to add a specific …

Custom “Terms and Conditions” acceptance checkbox in Cart page Woocommerce

Works on small home project, and want to add checkmark option bellow “Proceed to Checkout” button into Cart page into my Woocommerce site. I found this function, that is add that option: …

Custom remove cart item functionality in Woocommerce

I have the add item function set-up, which looks like this:

Displaying product thumbnail and attribute in Woocommerce cart and checkout

I am isplaying product attributes in my Woocommerce checkout table, see my previous question: Show Woocommerce taxonomy in emails I also want to show the product image, so my ideal would be: Product …

Add an additional cost to flat rate shipping each 3 items in Woocommerce

I’m running a woocommerce shop and using a Flat Rate shipping $15. I have written a formula to add $1.25 for each additional item. 13.50 + ( 1.25 * [qty]) Sipping “flat rate settings | $1.25 for …

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 …

Woocommerce Progressive extra cost based on total number of items in the cart

I am looking for some code which can make an extra charge based on the total number of items in the cart like: If number of items in cart is > 6 ===> extra cost = 5 If number of items in cart is > 12 …

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 …

WooCommerce Check stock of product ID before adding

I have some custom code in my WooCommerce site that adds a product to the users cart. I already have it check the cart contents to make sure there is another product in the cart first, but I also …