WooCommerce

Disable Payment Gateway for Specific Country

In this tutorial we are going to talk about country based payments in WooCommerce. Because it is a common case that some payment gateways may not work for specific countries.

In this tutorial I will show you how to condition it easily and without any plugins.

Here is what we are going to create:

restrict WooCommerce payment gateways by country selected
At the moment of writing this tutorial PayPal doesn’t work for Monaco. So let’s deactivate PayPal payment gateway for Monaco.

Add ID Column to Payment Methods Table

Sometimes when you work with payment gateways on your website, you need to know their IDs (slugs). In this tutorial I show how to add a column to the payment gateways table in WooCommerce settings using a small piece of code.

Here is our result:

Payment method ID column
“Misha Gateway” is a custom payment gateway we created in this tutorial.

Add Product to Cart Programmatically

Usually when I work with any WordPress or WooCommerce projects, if I face with something new during the development process, I usually try to share what I learnt immediately on my blog, here. But not always I did that. In 2014 I began my work with the awesome and super complicated project with WooCommerce, WooCommerce Memberships and WooCommerce Subscriptions. Let me share with you a piece of that work.

In this tutorial I am going to show you a different ways of adding a product to WooCommerce cart via code.

And by the way, if you were looking how to add product to an order, you need a completely different tutorial – here it is.

Add or Change Content of Default Product Tabs

In this tutorial we are going to talk about WooCommerce product tabs, the default ones – “Description”, “Additional information” and “Reviews” tab. First of all I will show you how to add default content into them and then we will also add something custom as well.

Create a Custom Product Tab

In this tutorial I will show you how to add a new tab on WooCommerce product page. We are going to do it without plugins because it is really easy. Well, it depends on what you are going to display inside your tab, but in general it is simple.

You may also be interested in how to remove default tabs or rename them or change their order.

Now let’s take a look at the screenshot what we are going to achieve in this tutorial.

woocommerce add product tab
The product tabs may look differently depending on a theme you’re using. I am using WooCommerce default theme – Storefront.

Change Product Tabs Order

The good news is that we do not have to deal with sorting arrays like we did with my account menu or admin columns for example.

Each of the tabs has its own priority value:

  • Description – 10,
  • Additional information – 20,
  • Reviews – 30.

Change Product Tab Titles and Headings

In this tutorial I will show you how to rename WooCommerce product tabs. Each tab has a title which is the link text you click in order to change the tab and also each tab has its <h2> heading which is displayed just before the tab content. By default appropriate titles and headings are the same. In this tutorial I will show you how to rename all of them.