WooCommerce
May 27, 2020

Set cart item price from a hidden input field custom price in Woocommerce

First for testing purpose we add a price in the hidden input field as you don’t give the code that calculate the price:

Then you will use the following to change the cart item price (WC_Session is not needed):

Code goes in function.php file of your active child theme (or active theme). Tested and works.

Related Post


How Create Custom Order in Woocommerce

Paste the code where you can get the customer data Here is the function for creating the order

Add Product to Cart if Cart Empty Woocommerce

We can add product to WooCommerce cart using add_to_cart() function with $product_id. Code goes in function.php file of your active child theme (or active theme).

Add an Empty Cart button in WooCommerce

WooCommerce default not provide Empty Cart button but we can two simple steps to add Empty Cart button on cart page. The first one is to add below code in your functions.php file (this file is located in your theme folder): Second step is to add Empty Cart Button after Apply Coupon button. This code […]

Only Allow 1 Product in the Cart WooCommerce

We can set add to cart limit on WooCommerce cart using woocommerce_add_to_cart_validation filter. Add below code on functions.php file to limit your WooCommerce Cart to just 1 product.

WooCommerce Remove the Additional Information and Order Notes fields

We can remove the Additional Information and Order Notes fields in WooCommerce checkout page with 2 filters that you add to functions.php file.

WooCommerce Redirect to Custom Thank you Page

The below code allows you to redirect to a custom page after the user has successfully completed a purchase when using WooCommerce plugin. Simply add the below code to the active child theme function.php and replace the URL in the function wp_redirect() to the desired page.


Leave a Reply

Your email address will not be published. Required fields are marked *