woocommerce Archives - WizMojo

How to activate ‘Add to cart’ buttons in WooCommerce archives/shop page?

Hello WordPress developers. This is one of the most common question I have come across the internet while developing an E-commerce website using one of the best plugin ‘WooCommerce – Excelling ecommerce’ by WooCommerce. Unfortunately WooCommerce haven’t provided any visible option to activate this handy feature to show ‘add to cart’ on homepage, shop page or archives whatever you want to call it. This is how it looks without ‘Add to cart’ buttons.

Without Add to cart buttons

 

And this is how it will look after adding ‘add to cart’ buttons. Looks cool ‘eh?

With add to cart buttons

 

Trust me its really easy to do, no rocket science involved. Many professional coders write their own snippets to add this function but guess what, WooCommerce themselves has added this feature but its hidden or not mentioned. Now you must be thinking where it is hidden? Let me show you where it is.

If you go into your WordPress dashboard and then to the Appearance > Editor and select your theme from the option ‘Select theme to edit:’, you have now all core files of your theme with so much code in it. Don’t worry you don’t really need to mess up with much of them but only a single file. If you are using WooCommerce plugin compatible theme then the plugin itself add functions automatically to your theme files to function properly. Like I’m using Divi theme from Elegant themes, its amazing.

1. Find ‘functions.php’ and click on it.

Functions.php

 

2. Press Ctrl + F (Command + F for Mac users) and find this piece of code.

remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );

remove_action

 

3. Simply delete ‘remove_action’ and replace it with ‘add_action’ or you can also just replace by copying the whole code given below.

add_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );

 

And it should look like this:

add_action

 

It should fix your problem. Happy WordPressing. 😉

Tagged : / / /

Yoast WordPress Plugin OnPage SEO configuration for Woocommerce

Have you ever worried about building ecommerce website on WordPress Woocommerce but you are not aware how to configure woocommerce site for OnPage SEO optimization. Unlike WordPress blogs, Woocommerce is but tricky to configure for onpage SEO, sometimes people end up doing wrong Yoast configuration and find their website nowhere or they index wrong page structure.

Install WordPress Yoast Plugin

Wordpress Yoast Plugin

Remember to keep it updated every time Yoast Updates their plugin.

 

Homepage SEO configuration

Woocommerce Home Page SEO Configuration

 

Activate XML sitemap and exclude irrelevant pages

 

Wordpress Yoast Plugin 3

You will probably have different boxes , all you need is to check those boxes you want index in Google search.

Noindex and Nofollow pages with duplicate content like TOS, Checkout and “Privacy Policy Pages” pages etc.

Woocommerce Nofollow and noindex

 

Add social profiles

Wordpress Yoast Plugin Add social profiles

Add Robots.txt file

Robots.txt file helps to search engine crawlers to figure out which page to crawl and index, some time search engine crawlers crawl and index the unnecessary pages like from wordpress plugin directory or wordpress code file. So in order to avoid this, use the following robots.txt file.

Woocommerce robots.txt file

User-agent:  *
Disallow: /cgi-bin/
Disallow: /wp-admin/
Disallow: /wp-content/
Disallow: /wp-includes/
Disallow: /recommended/
Disallow: /comments/feed/
Disallow: /trackback/
Disallow: /index.php
Disallow: /xmlrpc.php
Disallow: /wp-content/plugins/

User-agent: NinjaBot
Allow: /

User-agent: Mediapartners-Google*
Allow: /

User-agent: Googlebot-Image
Allow: /wp-content/uploads/

User-agent: Adsbot-Google
Allow: /
 
 
User-agent: Googlebot-Mobile
Allow: /

sitemap: http://replaceyourdomainhere.com/product-sitemap.xml
sitemap: http://replaceyourdomainhere.com/post-sitemap.xml

I hope that the next time you’re about to configure Yoast, you will find these tips helpful.

Tagged : / / / / /