Variable product add to cart in listing page

For variant products, in listing pages it only shows ‘select options’. Once user clicks it, it takes them to product details page and there they get options to select proper variant and add to cat button. But what if, you want your customers to select options from product listing pages like shop page, category page, archive page etc directly ? Then you need to follow these steps – In your theme, create a folder called woocommerce if you don’t already have one in there. In your plugins folder, go to woocommerce > templates and copy the content-product.php file from there to the woocommerce folder we created in your theme in Step 1 above. If the template already exists in ‘woocommerce’ folder no need to replace. Now open the template file and look for a code – do_action( ‘woocommerce_after_shop_loop_item’ ); replace the above mentioned code with following lines – remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_title’,…

Continue Reading Variable product add to cart in listing page

Split cart items by shipping classes in WooCommerce

Assume you need to avail different shipping methods for different items in your store. But if both type items exists in your cart then how to do that ? The first step you have to do is splitting the cart…

Add plugin settings link to WordPress plugins page

If we write some functionality to our website which is not at all dependent on our theme, then it is always better to write those codes to a plugin page(creating new plugin) instead  of theme’s functions.php. So if we change…

Change flat rate shipping price

This article is about how we can change flat rate shipping charge. There are many scenarios like – 1. If a cart having few specified items from some category we need to change flat rate shipping. 2. For a particular…

Show/Hide payment gateways according to shipping method

We often face this issue.  Sometimes we want to activate specific payment gateways  depending on selected shipping method. Here is the code —   Line 2 : We are getting the selected shipping method. Line 4: We are checking whether…