How To Disable Bots Crawling Cart Links

Reading Time: < 1 minuteHaving search engines crawl add-to-cart links and other unwanted pages can damage your SEO rankings. Add-to-links can cause more specific issues because those pages are not cached, and this can also increase your CPU and memory usage as they are hit repeatedly. Fortunately, it is very simple to adapt your site’s robot.txt file to make sure Google and other search engines are only the crawling pages you want. You can these lines of code into the site robots.txt file, specifically to address the add-to-cart links:
User-agent: *
Disallow: /*add-to-cart=*
When you add these lines to the robot.txt file the file is not saying that any search engine that hits the site cannot index your add-to-cart links. We also recommend that you adapt your robots.txt file to disallow indexing of the cart, checkout and my-account pages, which can be done by adding the lines below, to the same file.
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/

How can I add external/affiliate products to my store?

Reading Time: < 1 minuteIf you sell products as an Amazon, or other company affiliate, then you probably want to mark those products as external or affiliate products. This is something you can do within a default WooCommerce install, and it requires no special plugins or code. First, add your new product, then choose External/Affiliate product from the Product Data dropdown menu. In this section you can set the external URL, any special button text, and the price. Example:

Add Custom Tabs In WooCommerce Using ACF

Reading Time: 3 minutes

Advanced Custom Fields Pro is a plugin that allows you to do a number of things. However, in this tutorial, we’re going to walk you through how to add custom tabs to WooCommerce products.

Continue reading “Add Custom Tabs In WooCommerce Using ACF”

How To Search WooCommerce By Full Name?

Reading Time: < 1 minuteBy default, WordPress will only let you search by email address or username on the Users page, which can make it hard to find information quickly. Installing the Full Name Search in WP-admin plugin will allow you to search by a customer’s first name and full name.

Setup WooCommerce Notifications When New Account Is Created

Reading Time: < 1 minute

Keeping track of customer accounts is important, and if you want a site administrator to receive a notification that’s a simple task. You can add this code snippet via the Code Snippets plugin (recommended), or manually by pasting it into your theme’s functions.php file:

<?php // Do not include this if already open!

/**
 * Code goes in theme functions.php.
 */

add_action( 'woocommerce_created_customer', 'woocommerce_created_customer_admin_notification' );

function woocommerce_created_customer_admin_notification( $customer_id ) {
  wp_send_new_user_notifications( $customer_id, 'admin' );
}

Just change “admin” with the username you want the emails to go to.

Happy Modding!

How To Display Stock Status for Product Variations

Reading Time: < 1 minute

If you have products that tend to sell out, or that you typically sell in bulk, it might be beneficial to display the available product quantity. This can ensure your customers can order the quantity or volume they need.

Displaying your stock availability is as simple as adding a quick code snippet to your theme’s function.php.

<?php 
add_action( 'woocommerce_after_add_to_cart_form', 'dropdown_waitlist_label' );
function dropdown_waitlist_label() {
	echo "
		<script>
		jQuery(document).ready(function($) {
			var variation_data = $('form.variations_form').attr('data-product_variations');
			var variation_data = JSON.parse(variation_data);
			$('#pa_size > option').each(function() {
				for (var i = 0; i < variation_data.length; i++) {
					var variation = variation_data[i];
					if ($(this).val() == variation.attributes.attribute_pa_size) {
						if ( false == variation.is_in_stock ) {
							$(this).text( variation.attributes.attribute_pa_size + '\u00A0\u00A0\u00A0–\u00A0\u00A0\u00A0\u00A0Out of Stock');
						}
						if ( variation.min_qty == 1 && variation.max_qty == 1 ) {
							$(this).text( variation.attributes.attribute_pa_size + '\u00A0\u00A0\u00A0–\u00A0\u00A0\u00A0\u00A01 left in stock' );
						}
					}
				}
			});
		});
	</script>";
}
view 

Happy customizing.

How To Add Custom Registration Fields Using Product Vendors?

Reading Time: 3 minutes

As the internet evolves, so does the information you need from customers when they register with your store. It’s likely that a default registration form will cover everything you want to gather when some signs up. For example, having social media usernames can help you keep in touch, but those fields are not automatically part of the default form.

Continue reading “How To Add Custom Registration Fields Using Product Vendors?”

How to Display Checkout Fields In WooCommerce

Reading Time: 4 minutes

WooCommerce out of the box is great. It helps you quickly build a checkout process, gives you basic reporting, provides you with a way to add products to your store, and even helps setup shipping for you. But what happens if you want a little more control over your checkout process? What if you want to push the boundaries a bit and hide some checkout fields from the checkout process on specific products or product categories where those fields don’t make sense?

That’s what we’re going to cover in this tutorial.

Continue reading “How to Display Checkout Fields In WooCommerce”

Increase Default Product Variations in WooCommerce

Reading Time: < 1 minute

There are case by case instances where you might want to change the number of default product variations. By default, WooCommerce only allows for 30 product variations.

The good news is that you can add a simple code snippet in your theme’s functions.php file.

Add the code below to your theme’s functions.php file and change the number for the number of variations you want to for your products.

function custom_wc_ajax_variation_threshold( $qty, $product ) {
	return 10;
}

add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 );

With this code now in your functions.php file, you can modify the amount whenever you want.

We pride ourselves on being The Most Helpful Humans In Hosting™!

Our support staff is always available to assist with any issues related to this article, 24 hours a day, 7 days a week 365 days a year.

We are available, via our ticketing systems at support@liquidweb.com, by phone (at 800-580-4986) or via a LiveChat or whatever method you prefer. We work hard for you so you can relax.

Use ACF Pro To Add Custom Tabs In WooCommerce

Reading Time: 2 minutes

Advanced Custom Fields Pro is a plugin that allows you to do a number of things. However, in this tutorials, we are going to walk you through how to add custom tabs to WooCommerce products.

Continue reading “Use ACF Pro To Add Custom Tabs In WooCommerce”