The Ultimate Guide to WooCommerce Product Shortcodes

WooCommerce supports a long list of shortcodes that you can find here. This post covers only WooCommerce products shortcodes, which are the ones that display products only. Let’s go over them step by step.

Quick shortcodes to display your products

Display all products

If you want to display all products on your store, simply use this shortcode:

display all products shortcode

Display featured products

To display all WooCommerce featured products on your store, use this shortcode:

display all featured products shortcode

Display all on-sale products

To display all on-sale products, use this shortcode:

all sales products shortcode

Display all best selling products

To display best selling products, you can use this shortcode:

best-selling-products-shortcode

Customize the display of products with attributes

Now you know all the important shortcodes to display WooCommerce products. However, what if you want to specify how many products per line, per page…? This is where attributes come into play.

Specify how many products per row with columns

If I want to display three products per row, I’ll use this shortcode:

specify number of products per row

And sure enough, I have a page with all of my products, 3 items on every rows:

specify number of products per row

I only write the shortcode with products, however, the same logic can be applied to all the shortcodes above (featured_products, sale_products…)

Limit number of products to display with limit

If your store has many products, it’s wise to limit the number of products to display with the limit attribute.

For example, the following shortcode limit only 9 products to display:

Of course, you can combine multiple attributes together to achieve more complex display. The following shortcode display 10 products, 5 per line:

combine multiple shortcode attributes

Products pagination with paginate

In case you have multiple products and you want to display them in multiple pages, the paginate attribute is what you need. You also need to set how many products you want to display PER PAGE with the limit attribute.

For example, the following shortcode display all products in multiple pages, 4 products per row, 12 products per page:

Display products from specific categories

There are times you don’t want to display all products. Instead, you only need products from specific categories. In this case, you can specify the list of category slugs in your shortcode:

display-products-by-category

In this example, I want to list products from 3 categories which have their slug as hdd, ram, ssd accordingly.

How can you find product categories’ slugs? Simply go to Products->Category and look for the slug field of the categories you want:

how to find product category slugs

Set products’ order by order and orderby

By default, WooCommerce display products order by their title. However, you can change this behavior by using order, and orderby attributes.

The available value for orderby are:

date – The date the product was published.
id – The post ID of the product.
menu_order – The Menu Order, if set (lower numbers display first). This can be set for each product in product data tab
popularity – The number of purchases.
rand – Randomly order the products on page load (may not work with sites that use caching, as it could save a specific order).
rating – The average product rating.
title – The product title. This is the default orderby mode.

There are only two available value for order:

ASC: ascending, products that have lower value (as specified by orderby) come first

DESC: opposite of ASC

For example, I want to display all products, order by rating in descending order, I would use this:

Conclusion

As you can see, shortcodes can be very powerful if you them correctly. The list above is not exhaustive. If you have suggestion or request, please let me know.

 

 

How To Fix Add To Cart Button Not Showing In WooCommerce Product Page

So you’ve decided to use WooCommerce to power your store, great! You got it installed, created your first product and clicked on the product link with excitement. However, all you see is this:

add to cart button is not showing on woocommerce

Where is the add to cart button? You wonder. How can someone buy your product without that button?

Don’t panic! This issue is quite popular and quite simple to fix too. Let’s find out why your add to cart button is not showing and how can you fix.

Why your add to cart button is not showing

The reason why you don’t see the add to cart button on your product page is because your theme doesn’t support WooCommerce. It sounds strange to you but not all themes out there support WooCommerce.

When you started your site, you might not expect to sell anything. For example, you started a blog to write about your favorite topics. Your intention was to share the idea. You didn’t anticipate one day you’ll sell a book on your site.

And that’s normal. Our lives are filled with surprises.

So, what can you do about this? Let’s discuss the solutions.

How to get the add to cart button to show up on your WooCommerce product page

There are two solutions for this problem. As the cause is your theme lack WooCommerce’s support, you may see the first solution is to change to one that supports WooCommerce. That’s the best solution, if you can afford it.

Changing theme for your site is easy when you haven’t done much customization based on your current theme. However, if you have built a child theme to extend your current theme’s functionalities, changing it to something else can be very expensive.

Even when you don’t have many attachments with the current theme, finding a new theme can take days.

So, in case you can’t change or don’t want to change your current theme, read on.

Fix add to cart button not showing by customize your theme file

You are about to enter some code but don’t worry, it’s very simple. Let’s go to Appearance->Theme Editor. You may see a dialog says be careful. Click on I understand and proceed.

Now, look at the right side. You’ll see something similar to this (chances are you are using a different theme so the list of the files are not identical):

current-theme-files
current-theme-files

Pay attention to these two files:

  1. single.php
  2. index.php

If you see single.php, click on that. Otherwise, click on index.php

Since my theme has single.php file, I click on that. Yours could be different. However, it should contain the line starts with get_template_part as I highlighted in the screenshot below:

edit wordpress template file

now copy that line and replace it with the following code:

if ( is_singular( 'product' ) ) {

    wc_get_template_part( 'content', 'single-product' );

} else {
    //paste the line you copied here (replace the whole line, including //)
}

Make sure you replace your own line (the one you copied) to the second block.

In my case, my code would look like this:

if ( is_singular( 'product' ) ) {

    wc_get_template_part( 'content', 'single-product' );

} else {
    wc_get_template_part( 'content', 'single-product' );
}

Finally, save the file. Let’s check out my product again.

add to cart button show up on product page

As you can see, the add to cart button appears. I also have the PayPal button appears since I installed PayPal gateway plugin.

Conclusion

As you can see, it is quite simple to fix add to cart button not showing up on your product page. However, even when it is fixed, the product page’s appearance may not be what you like. In that case, you may need to hire someone to customize that page for you. Any decent WordPress developers would be able to do that for you.

The Ultimate Fix To WooCommerce Not Sending Email Notifications Problem (For FREE)

If you are serious about your WooCommerce store then the emails sending function is very important. Most of the time, you send emails to your customers following their purchases, their contact form submissions. You may also send emails contain coupons to your customers on their birthday. You also need to get emails regarding your store status. None of those things happen if you have WooCommerce not sending emails problem.

The prevalent of emails problems in WooCommerce (and WordPress)

By default, WooCommerce uses the wp_mail function of WordPress to process its emails. wp_mail in turn based on the mail function of PHP (the programming language that made WordPress). Without proper configurations, the mail function rarely works. On the occasions it does, most of your emails will go to spam folder. In fact, most sites use default mail settings, which make the mail sending success rate pretty low.

How to fix WooCommerce not sending emails

As you can see, WooCommerce has nothing to do with deliverability of its emails since it utilizes the function from WordPress. So, the right question to ask is how to fix WordPress not sending emails.

Fortunately, the fix is quite simple.

Let’s get started.

Step 1: Get a free email (gmail, mail.ru…)

The first step is to register an email. The reason is we are going to use the mail server of those email providers (gmail, mail.ru) to send our emails, not our host’s server. Using those email providers’ servers increases email deliverability (the success rate of sending email) greatly.

Step 2: Get the STMP configuration of your email

The configurations depend on the email service you use. For example, Gmail SMTP settings would be:

  • Server address: smtp.gmail.com
  • username: Your Gmail address (for example, example@gmail.com)
  • password: Your Gmail password (or app password)
  • SMTP port  587 (TLS)/465 (SSL)
  • TLS/SSL required: Yes

If you use a different provider, you can search for provider + “smtp settings” to get the right configurations.

In the case of Gmail, if you want to use SMTP settings, you may need to disable two-steps authentication or create an app password

Now, you got the configurations. Let’s move to the next step:

Step 3: Install Easy WP SMTP plugin

Our next step would be installing Easy WP SMTP plugin (click on the link to download or you can install from your dashboard). It’s a plugin that let you specify the SMTP settings then wp_mail will use the mail server you put in this plugin to send email instead of your website’s host.

Now you have the plugin installed and activated, click on the settings link under its name:

click on easy wp smtp settings to start configure smtp

You’ll see the page where you put all the details as below:

As you can see that, I use an account from mail.ru. However, with other email providers, you can enter the same details except these fields:

  • From email address: that’s your email address
  • From name: this is what your customers see in the sender name of your email. So, pick something that represents your store
  • Reply to email address: When the recipients hit the reply button, which email will receive that reply. This could be a different email, maybe your dedicated email to handle supports
  • SMTP host: the smtp server you got from Step 2 above
  • SMTP user name: your email
  • SMTP password: your email’s password (or app password in case of Gmail)

Now, with all the info entered, click on save changes.

Step 4: Test your email settings

The final step would be testing if the configuration works. Still in Easy WP SMTP, click on test email.

send test email to confirm smtp settings work

Enter a valid recipient in the To field and some dummy text in subject and message field then click on Send test email. If your setup is correct, you’ll see the email goes through:

email sent successfully

As you can see, I got the test email in my other account.

Conclusion

Emails are still very important for any ecommerce store. In fact, it’s the main channel to communicate with your customers. If your WooCommerce store fails to send emails, that’s a big problem. Hopefully, the tutorial I made it this post can help you fix WooCommerce not sending emails problem. Notice that free email services have their limits on how many emails you can send per day (500 in the case of Gmail). If you go pass that limit, exceeding emails will not be sent. In that case, you may want to use a dedicated email service such as Amazon SES or Sendgrid to deliver your emails.

 

How To Reward Loyal Customers With Store Credit in WooCommerce

There are many ways to reward your customers. One of the most common methods is to offer coupons. However, the problem with coupons is the customers need to remember the code. There is a better way to reward your customers. That is to use store credit. This post will show you how you can create store credit for one or many customers so they can use the discounts on your store without remembering the coupon code.

Get WooCommerce Smart Coupons Plugin

WooCommerce by default doesn’t support store credits. To use this feature, you need to install an external plugin called WooCommerce Smart Coupons.

Send store credits to customers by email

Now you have WooCommerce smart coupons installed and activated. Let’s go to WooCommerce->Coupons:

woocommerce smart coupons dashboard

If you visited WooCommerce’s default coupons screen before, you’ll notice there are many differences. However, our focus in this post is store credit. Let’s click on “Send store credit” tab.

send store credit to customers

As you can see that, the interface is quite simple. You need to first, specify the list of emails of the recipients. If you have more than one email, then separate them with commas. Next, you enter an amount that you want to give to the customers as credit. Then, finally, you can enter some messages to the customers.

After that, you hit send. This is what the customers receive:

store credits sent to customers

Your customers don’t get the emails? Then maybe your site has problem sending emails. Check this WooCommerce Email not sending fix now

Now, you can see that the email owner has got a coupon code. If the emails you entered are from store’s customers (they already registered on your store), then that person can login and use the store credit without remembering the coupon code. Otherwise, she will need to copy that coupon. Sounds confusing? Let me demonstrate.

Apply store credits on checkout

The email I sent to above is from a registered customer. Now, if he login in to the store and add items to cart, nothing happens. However, on the cart page, the customer will see this:

store credits displayed on cart page

If I click on the coupon, the discount will be applied instantly:

Now, if the customer decides not to use the credit but give it to someone else, she can just send the coupon code to that lucky person. In this case, that lucky person needs to enter the coupon code on cart page to get the discount:

apply store credit using coupon code

After clicking on Apply coupon, you’ll see the discount applied:

Now, it works just like a coupon.

Conclusion

As you can see, store credit is basically a coupon. However, it offers more flexibility to you as store owner. You can create and send credits to many users at once. If the customers are registered, they don’t need to enter the coupon code and just like coupon codes, they can give it to other people to shop on your store. Make sure you get WooCommerce smart coupons plugin here first.

 

WooCommerce Dynamic Product Pricing & Discount – The Ultimate Guide

By default, WooCommerce products have fixed price. That means if you want to change the price of a particular product, you need to login and edit the product price. This is where the idea of WooCommerce dynamic product pricing came from. With dynamic pricing, you can set rules so you can offer some flexible pricing structure to your product. Take these cases for example:

  1. You want to encourage your customers to buy more products from your store. For example, if the customer buy one product A they will get another item for free (it doesn’t need to be buy one get one, you can set the rule to buy X get Y and they don’t have to be the same products. For example, you want to create a promotion program that if a customer buy a jacket, they will get a belt for free or 50% discount).
  2. You want to reward customers with large purchase. If they order more than $200 (but less that $300), you’ll give then 10% discount. If they order more than $300, you’ll give them 20% discount.. and so on.
  3. You have variable products and only want to offer discount on a particular variation.
  4. Give the customer discount based on number of product they purchase. For example, buy 10 get 10% discounts, buy 30 get 15% discounts…

Let’s discuss each case and find out you can achieve that with WooCommerce dynamic pricing.

Get WooCommerce dynamic product pricing plugin

To follow along, you need to have WooCommerce dynamic product pricing plugin from WooCommerce.com. You can get it following this link.

Now, let’s go through each case and find out how to do that.

Case one: The classic buy one get one (BOGO)

As the name suggests, you want to give the customers a reward for purchasing a particular product. For example, I have an electronic store that sell smartphones and smartwatches. I want to create a rule that:

If the customers purchase two phones, I’ll give a smartwatch for free.

You can apply this rule to create many kind of creative incentive to encourage your customers to buy more from your store. Here are some examples:

  • Buy one (any number here) shirt, get 50% off socks
  • Buy 2 items, the next item is free…

OK, let’s get back to our example. Here is the list of all products on my store:

all products on store

As you can see, I have one smartphone and three smartwatches. In this example, the rule I’m going to create says: For customers who buy 2 ZTE phones, I’ll give one IYOU smartwatch for free.

Now, let’s go and edit the IYOU watch. Let’s scroll down to the product data section, you’ll see there is a new tab called Dynamic Pricing. Click on that at set the options as following:

setting up dynamic pricing for buy x get one free

Here is the quick explanation of each fields in the picture:

  1. Applies to: This rule applies to everyone. There are two more options, which are Guest and Specific Role. That means you can apply this rule to customers with specific role only. It’s a good option to create a reward to specific group of customers.
  2. Quantity based on: This is the base to calculate the discount. As the rule I mentioned above said: “buy two smartphones will get one smartwatch for free” so count the quantity based on Category and the field #3, I set the category to smartphone.
  3. Product/Variation: You can select to give a specific variation of this product as a reward (if the current product is a variable product).
  4. Rule process mode: There are two modes: Bulk and Special Offer. For buy X get Y free, we are going to use Special Offer.
  5. Date: You can specify the date range that this offer is valid.
  6. Finally, the rule. As you can see, I set the purchase number to 2, the receive number to 1, percentage discount to 100. That means if the customers buy two products from the category I specified in field #3, they will get one product (the one that we are editing) with 100% discount. The repeating is currently set to No. If it is set to yes, that means the customers can buy 4 smartphones and get 2 smartwatches, 6 smartphones and get 3 smartwatches and so on

Now, let’s save the product and make a test purchase of two smartphones and one smartwatch (the IYOU). Sure enough, when go to cart, I see this:

buy 2 get 1 free woocommerce

As you can see, the watch has a 100% discount.

Case two: Offer discount based on cart amount

Now, there is a new scenario. You want to reward customers with large purchases and also encourage them to purchase large quantity. Here is the discount structure based on cart amount:

Order amount$100 to $200$200 to $400More than $400
Discount amount10%20%25%

Now, let’s get this setup.
Under WooCommerce, go to Dynamic pricing:

create discount based on cart total

You can see that there are three tabs. We focus on the first tab in this case, which is Order totals.

So, let’s click on Add pricing group button and setup the rules:

create three tiers rules for cart based discounts

As you can see, the rules are quite straightforward. We create the rule based cart total, applied to everyone and have no specific start and end date. In the table at the bottom, there are something you need to pay attention to:

  1. WooCommerce’s precision is up to cent. That’s why I need to enter 200.01, 400.001. If I entered 201 or 401, if someone buy more than 200 but less than 201, they will not have any discount (same goes with the case of 400 and 401)
  2. In the third rule, as I mentioned at the beginning of this case, we apply a 25% discount on orders > $400. In the max order total, I entered the * (shift + 8) symbol. This is required by the plugin if you don’t have the limit.
  3. You can enter as many rules as you want, simply click on the (+) icon on the right to add more row.

Now, let’s save the rule and make a test purchase.

10% discount on order more than 100 but less than 200

10 percent discount for order more than 100 less than 200

20% discount on order more than 200 and less than 400

10 percent discount on order less than 200

25% discount on order more than 400

25 percent discount on order more than 400

 

Case 3: Offer dynamic pricing on bulk order

There is a another way to reward your customers is to give discount on large items purchase. For example, you want to implement this discount structure:

Amount purchase10 to 20 items21 to 3031 and more
Amount discountdiscount $5 per itemdiscount $15 per itemdiscount $20 per item

Let’s take my store for example and I want to apply this structure on the ZTE phone. So, I edit the product and go to Product Data -> Dynamic Pricing and add rules like this:

create discount based on number of items purchased

As you can see, this discount is for everyone, based on this product’s quantity (not based on products from other categories as in the first example) and the Rule processing mode in Bulk (instead of Special offer).

I think you have no problem understanding the table at the bottom. Now, save the product and make some test purchases:

No discount for quantity less than 10:

no discount if the quantity is less than 10

If the purchase is more than 10 items, a 5 discount is applied to all products:

each product gets a 5 discount when the items is more than 10 and less than 20

For order from 21 to 30, customer gets a $15 discount on each product:

for order more than 20 and less than 30 user gets 15 discount

Finally, if the customers buy more than 30 items, they will get a 20 discount on each product:

customers get 20 price discount on order more than 30 items

You can easily change the discount type to percentage instead of a fix amount. In addition to these two option, you can also set the product price to an amount. For example, when the customer purchase 10 items, the price is $100, when they purchase 100 items, you may set the price to $50. This is just an example to show you how flexible WooCommerce dynamic product pricing is.

Conclusion

As you can see, with WooCommerce dynamic product pricing, you can create some great offer for your customers to encourage them to buy more products. At the same time, the customers are rewarded for their purchases. It is a win-win situation and any store can apply this to increase more sales and customers’ loyalty. You can get WooCommerce dynamic pricing plugin here to get started.