How To Set Woocommerce Custom Shipping Cost Per Product

The goal

Learn how to set custom shipping cost per product in WooCommerce.

The method

We are going to use WooCommerce shipping class to set different shipping cost per product.

What is a WooCommerce shipping class

This is the definition of shipping class on WooCommerce documentation. I think it’s clear enough:

Shipping classes can be used to group products of similar type and used by some shipping methods, such as Flat Rate Shipping, to provide different rates to different classes of product.

For example, for a specific shipping zone, when you select a shipping method, inside the shipping method, you can set many shipping classes. Each class can have different cost. This makes it very easy for us to set different shipping cost for each product.

How to set custom shipping cost per product using shipping classes

This is our setup: We have two products, a hat and a vase. A vase requires a more careful shipping method because it’s fragile while a hat can use less secure shipping method. Now, we are going to create two shipping classes:

  1. Fragile product shipping
  2. Normal product shipping

As you can guess, the vase will use the first class, the hat will use the second.

Add shipping classes

Let’s go to WooCommerce->Settings->Shipping class and add these two classes:

add new shipping class

Let click on the “Add shipping class” at the bottom right. You will see there are input boxes appear for you to enter the details. Don’t worry if you don’t see the place to enter shipping cost. We’ll do it later in shipping zones.

Now click on Save Shipping classes and you are done.

Our next step is to create a zone and add shipping methods (if you haven’t got any).

Add shipping zone and shipping method

Let’s click on Shipping zones and click on Add shipping zone. You’ll see an interface appears to enter the zone details. In my example, I use Asia as my zone but you can use any other zones if you like.

add shipping zone

Now click on Add shipping method.

We are going to use the flat rate method.

Now, click on the edit link under the flat rate method:

setting cost for shipping class

Here you can see that there are settings to enter Shipping class costs. In this example, I set 20 for the Fragile product shipping class and 5 for Normal product shipping.

Now, click on Save changes, click Save changes again on the add shipping zone screen and you are done with setting up shipping classes.

Set shipping class per product

Finally, we are going to set the shipping class for our products.

setting shipping class

Let’s go to the product data area (right under the product description area) and click on shipping. When you click on the “Shipping class” drop down, you’ll see the two options we’ve just created. Select Fragile product shipping for the vase and Normal product shipping for the hat.

Now, let’s add vase and hat to cart and go to the cart page. You’ll see the shipping cost is added accordingly:

shipping cost for vase
Shipping cost for vase
shipping cost for hat
Shipping cost for hat
shipping cost for both
shipping cost for both

Conclusion

As you can see, using shipping class can let us setup some flexible shipping for our product. There is no limit of number of shipping classes you can create so you can easily have many shipping options.

The Easiest Way Remove The Add To Cart Button In Woocommerce

If you ever want to remove the “Add to cart” button in WooCommerce, there are quite a few ways. We are going to learn the easiest and fastest way to do so in this post.

The easy and safe method to remove the add to cart button in WooCommerce

The simplest way to remove the add to cart button is to hide it. The beauty of this method is you set it once and don’t have to worry about WooCommerce updates. We are going to set a CSS rule to hide the button.

First, go to your product page, right click on the add to cart button and select inspect:

inspect-the-add-to-cart-button

Now, there is a panel appears. It depends on your browser setting that the panel appears at the right or the bottom. In my case, it’s at the bottom:

Now, you can see that the element is a button (by looking at the <button opening tag). We pay attention to the class attribute. This button has three classes:

  • single_add_to_cart_button
  • button
  • alt

Now, let’s go to your dashboard, Click on Appearance->Customize.

You may have to scroll down a bit to see the tab Additional CSS. Let’s click on it and you’ll see a box to enter your code:

additional css box

Now, go to the bottom of that box and enter the following code:

.single_add_to_cart_button.button.alt {
    display: none;
}

Please note that there is no spaces between the classes. Let’s see the result:

hide add to cart button woocommerce

As you can see, once I put the code in the box, the button Add to cart disappeared.

Conclusion

There are more methods to hide the add to cart button. However, this is the fastest method and anyone can do it without worrying about breaking the site. If you ever want to see the Add to cart button again, you can go to the Additional CSS box and remove the code you’ve just entered.