All Questions
Tagged with cart hook-woocommerce
142
questions
0
votes
0
answers
31
views
How to override a specific condition inside filter "woocommerce_add_to_cart_validation"
I am using WooCommerce subscription and Mollie Payments for WooCommerce plugin.
It supports multiple subscription product to be purchased on a single checkout process, however when user tries to do a ...
0
votes
0
answers
29
views
Modify cart total and then order total when an order is placed in WooCommerce [duplicate]
I'm using this code to modify my total on the checkout page
However, if I place an order, the modified total is not reflected in the order itself, and still has the unmodified checkout total.
Can ...
0
votes
0
answers
40
views
Display cart Item custom download URL on WooCommerce Cart page
I ask the customers to upload a PDF file for each product being added to the cart, and need to display the file download URL for each cart item. It appears that WooCommerce strips HTML tags and doesn'...
-1
votes
1
answer
34
views
Wrong hook used when adding cart counter to site header [duplicate]
I'm trying to insert a cart counter in the header of a WooCommerce website, and have found that the code I used was breaking the checkout process (payment options were grayed out.)
Apparently my ...
1
vote
1
answer
68
views
Increase WooCommerce Cart Total Weight Based On Specific Shipping Class
I have some custom code in my functions.php file that changes the shipping class from 343 to 344 if more than one product with the shipping class 343 is in the cart during checkout. However, I need to ...
2
votes
1
answer
52
views
Allow only one downloadable product in WooCommerce cart
Here is the code that prevent to have more than one downloadable product in the cart:
add_filter( 'woocommerce_add_to_cart_validation', 'only_one_product_type_allowed', 10, 3 );
function ...
1
vote
0
answers
38
views
woocommerce_coupon_get_discount_amount returned value applied once per item, not once per cart
I am using filter woocommerce_coupon_get_discount_amount filter hook to recalculate coupon discount based on product attributes. Code calculates the result I want, but the returned value is applied ...
0
votes
0
answers
294
views
How to avoid PHP Notice: Get cart should not be called before the wp_loaded action
I would like to do a phone OTP verfication in woocommerce checkout page only for products in "lms" category, then I create this snippets:
function hkioh_is_lms_product_in_cart() {
...
0
votes
1
answer
127
views
Adding a fee to WooCommerce product variation passed to cart
I am trying to add a fee (20$) to a product when I add it to the cart.
My function works when the product is a simple product. But not when it is a variation product. I have tried the following code, ...
3
votes
1
answer
371
views
Woocommerce duplicate product in cart item without increasing the product quantity
I am trying to do BOGO on my site the scenario is when some one add a product to the cart with the quantity of 5 or some one in cart page increase a specific cart item quantity grater than 5 than ...
0
votes
1
answer
59
views
Changing tax rate on certain cart items in Woocommerce
I am inserting a control in the Wocommerce cart which, based on certain properties of the user and the inserted item, modifies the tax rate for that specific item.
The code I'm using, inside a plugin, ...
2
votes
1
answer
283
views
Remove Totals section from WooCommerce Cart while keeping Subtotal line
I've found some code from here: How to remove order total from cart and checkout page woocommerce
that will let me remove the entire 'Cart Totals' block from my cart page:
//removal of 'Total' block ...
0
votes
0
answers
101
views
Get Total Subtotal for products in 1 specific category in WooCommerce
I'm trying to use this code to get the subtotal for a specific category shoes and replace the default subtotal as i don't want to include subtotals from products in other categories.
function ...
0
votes
0
answers
71
views
Set Cart Total for a defined product Category in WooCommerce
I need to get the total cart price by product category, minus any products which aren't in the specific category on the cart page so just the subtotal for a specific category.
add_filter( '...
0
votes
1
answer
142
views
woocommerce discount cart withouth using add_fee method
The problem:
i want dynamically reprice the cart without repricing the articles to offer the customers one or more discounts.
i also asked chatgpt, but the solutions were not great, and I got the tip ...