WooCommerce
June 4, 2020

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).

Related Post


How to disable all payment methods in WooCommerce

You will have the need to disable all payment gateways on the site, but just disabling them in WooCommerce > Settings > Payments will not work because then the customers will get an error message since there are no payment methods available. We’re going to be using a different method here. The way to go […]

How do I change the link of the Return to shop button WooCommerce?

WooCommerce default redirect on shop page when Cart is empty. The filter woocommerce_return_to_shop_redirect makes it easy to change Return to shop link. Code goes in function.php file of your active child theme (or active theme).

Remove Product From Cart Programmatically Woocommerce

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

Display Total Product Sold Quantity to WooCommerce Page

Currently your customers have no idea how many quantity or downloads have been ordered from your WooCommerce site. So in order to apply this change, you can add below code into your child theme’s functions.php file. This snippet code show you how to display total product sold quantity WooCommerce page.

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.


Leave a Reply

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