The Ultimate Guide To WooCommerce Grouped Products

Alongside simple product, variable and affiliate product, grouped product is one of the four default product type of WooCommerce. Knowing how to use WooCommerce grouped product can help you deliver much more flexible product choices for your customers. In this post, let’s discover what WooCommerce Grouped product is and how it can help you grow your store.

 

What is WooCommerce grouped product?

Grouped product, as its name suggest, is a product that consists of a group of other products. You can think of grouped product as a container of other WooCommerce products. In real life, you see grouped products under the name of combo, set… For example, a BBQ combo may have one dish or tuna, two beer and two dishes of beef. Those individual can be sold individually. However, the guys at the marketing department may suggest that we create these combos to improve sales for our stores.

Why do you want to use grouped product instead of simple product

One good reason to use grouped product is to increase sales of more than one single item as mentioned above. Another good use case of group product is to sell products that usually go together. Computer set is an example. Many times people buy individual parts like monitor, keyboard, mouse… However, the people are very frequently shop for computer set instead of shopping individually.

How to create a grouped product

Creating a grouped product is very simple, especially with WooCommerce. Here are the steps to create a simple grouped product. Let’s go ahead and create a computer set:

First, let’s go to Products -> Add new

create a grouped product in woocommerce

Now, when you change the product type to Grouped product, you will see the field for price and sale price disappear! Don’t freak out. It makes sense since the price of the grouped product is the combination of its children’s price. You will also see the shipping tab disappear for the same reason.

Other than that, you will see that grouped product is similar to simple product. You can enter short description, long description, adding products feature images, gallery images as usual.

enter details for grouped product

After entering all the needed data, it’s time to publish the grouped product and have a look at its product page:

woocommerce grouped product

You may notice that there isn’t an add to cart button. The reason is simple. There isn’t anything to purchase yet. The next step is to add child products to this grouped product.

 

How to add single products into  a grouped product

Adding single products to a grouped products is simple. You need to make sure that you have all the individual products ready first. In this example, I have four simple products ready to add as below:

simple products in a grouped product

 

Now, let’s go to our newly created WooCommerce grouped product, then scroll down, click on Product data tab if it hasn’t been expanded already. Finally, click on Linked product:

adding simple products to grouped products - step 1

Now, let’s click on the Grouped products input box and start typing the product name. You will see the suggestions as you type:

adding simple products to grouped products - type suggestions

As you can see, as I typed UHD, the suggestion for the screen appear. Just click on the result to have it added to the grouped product.

After add all the products to the grouped product, you will see it appears like this:

adding simple products to grouped products - step 3

Hit the update button and let’s see the grouped product page:

woocommerce grouped product with child products

As you can see that, all child products are listed here. For the customer, he just need to enter the number of items per child product and begin to check out.

But wait!

Isn’t it silly to make the customer enter the number of parts when most of the time, the number should be 1?

You only need

  • one monitor
  • one keyboard
  • one case

per computer.

Well, if you ever wonder the same thing, you may want a different type of product called product bundle.

 

 

Use variable product in grouped product

At this point, you now how to create a grouped product and add single child products to that grouped product. You may wonder, can you add variable products to the grouped product instead of simple products? The answer is yes. However, without using any plugin, you may end up with something like this:

variable product inside grouped product

When you click on the select options button, you will get the that variable product page and you add the product to cart from that variable product’s page.

I’m not sure about you but that flow is not convenient for the customer.

So, it’s definitely possible to use variable product inside grouped product. However, in my personal opinion, it is not very convenient for your customers to go to extra steps to add the product to cart.

Ordering child products inside grouped product

In my example, you can see that the Samsung monitor is listed first then the case, then the keyboard and finally the mouse. You may wonder, how does WooCommerce sort these products and how can  you change their order?

For example, I want to list the mouse first, then the keyboard, then the monitor and finally the case, how can I do that?

It actually very simple.

Now, go to our grouped product and go to Product Data->Linked products:

You’ll notice the child products are in a list. You maybe surprised to find that every items on that list is draggable!

So, let’s re-arrange our child products:

After clicking on update product, I can see the product page with new ordering:

new products order in woocommerce grouped products

Show images for single products

At this point, your WooCommerce grouped product is looking good. However, you may notice that individual products in the grouped product don’t have product’s image. What if you want to add the products’ thumbnail just before the product name?

It’s time to add some code. You know where to put the custom code? In a child theme, of course. You must remember to add additional code in a child theme. You don’t know what a child theme is? Check out my ultimate guide to child theme in WordPress. Don’t worry, it’s short.

Now, let’s enter the following code at the end of your child theme functions.php file:

add_action( 'woocommerce_grouped_product_list_before_label', 'bc_woocommerce_grouped_product_thumbnail' );

function bc_woocommerce_grouped_product_thumbnail( $product ) {
    $attachment_url = wp_get_attachment_image_src($product->get_image_id(), 'thumbnail', false)[0];
    ?>
    <td class="label">
        <img src="<?php echo $attachment_url; ?>" />
    </td>
    <?php
}

Then save the file. Now, if you view the grouped product page, you’ll see this:

display single product thumbnail in grouped product with woocommerce

It looks better, doesn’t it?

Now, what if you want to display the thumbnail before the quantity box?

No problem, let’s replace the old code with this one:

add_action( 'woocommerce_grouped_product_list_before_quantity', 'bc_woocommerce_grouped_product_thumbnail' );

function bc_woocommerce_grouped_product_thumbnail( $product ) {
    $attachment_url = wp_get_attachment_image_src($product->get_image_id(), 'thumbnail', false)[0];
    ?>
    <td class="label">
        <img src="<?php echo $attachment_url; ?>" />
    </td>
    <?php
}

The only change is the part after add_action. In the previous code, the text right after the opening ( is ‘woocommerce_grouped_product_list_before_label’. Now it is: ‘woocommerce_grouped_product_list_before_quantity’

As you can guess, the thumbnail is now at the beginning of the row:

product image before quantity box in woocommerce grouped product

Conclusion

I hope you feel more comfortable with grouped product now. Grouped product is great for grouping simple products together in WooCommerce. You can use variable products in WooCommerce grouped products. However, due to the inconvenient checkout flow as shown above, I would suggest you use simple products only. You can also search for a plugin that  let you select the variable product right on the grouped product page. Doing so will greatly improve the customers’ experience on your website.

The Ultimate Guide to WooCommerce Flat rate Shipping

Flat rate shipping is the easiest shipping method to set up in WooCommerce. In this post, let’s find out how to set up flat rate shipping in WooCommerce and see how it fits to your business model.

What is flat rate shipping?

If you have sent a package via post office before, you should be familiar with flat rate shipping. As the name suggests, flat rate shipping impose an uniform shipping price on your package as long as it doesn’t exceed a certain weight or size.

For example, the shipping cost for packages less than 10 kg and 1 cubic meter is $10 per package.

The same idea applies to WooCommerce flat rate shipping.

How to add flat rate shipping in WooCommerce

By default, WooCommerce has three shipping methods

  • flat rate shipping
  • local pickup
  • free shipping

In order to use one of those method, you need to create a shipping zone first then in the zone, you can add one or more shipping methods, including flat rate.

how to add flat rate shipping to shipping zone in woocommerce

After creating the flat rate shipping method as in the above image, you can configure the rate, tax of that shipping method by clicking on the Edit link under “Flat rate”:

configure flat shipping rate and tax

As you can notice, there is a toggle button right below the Enabled title. You can enable or disable the shipping method by turn that button on or off.

Can I have multiple flat rate shipping setup?

There is no limit on number of shipping method per zone so you definitely can have multiple flat rate shipping setup, in one zone. You may wonder, why do I need multiple flat rate shipping for one zone?

One good example is you provide standard shipping at a lower rate and priority shipping at higher rate. At the cart page, customers can choose which shipping method they want to use. If they need the products to be delivered fast, they will choose the priority shipping method. Otherwise, they can choose the standard shipping method to save money on shipping.

Let’s set that up:

adding multiple flat rate shipping for one zone

Now, on the cart page, the customers will see all the shipping options available:

flat rate shipping options on cart page

 

How to add flat rate shipping per item using shipping classes

At this point, you should be comfortable with adding flat rate that applies to all items. What if you want to set a different shipping rate for some particular items? For example, I have a store selling computer hardware. While keyboards, mice can be shipped without much care, monitor requires special packaging and handling. I would like to charge $50 more for monitors. How can I set that up?

First we need to add a shipping class. Adding shipping class in WooCommerce is simple. Let’s go to WooCommerce->Settings->Shipping->Shipping classes and add one:

add a shipping class in woocommerce

Now, the next step would be to go the monitor and assign it the “monitor” shipping class:

assign shipping class to product

Finally, let’s configure the shipping rate for “monitor” shipping class in our shipping methods.

Let’s go to WooCommerce->Settings->Shipping->Shipping zones and edit our zones. Let edit all the enabled flat rate shipping method in that zone and add the additional fee accordingly:

add shipping cost to shipping class

Now if I go to the cart, I can see that the shipping cost is higher:

shipping cost updated after using shipping classes

If you remember, the standard shipping was $10 and the priority shipping was $30. Since we added $30 for the “monitor” shipping class, the shipping cost updated accordingly.

WooCommerce flat rate shipping by quantity

If you notice that we have 2 items in cart here. The shipping cost for the “monitor” only calculated once. What if you want to charge the additional shipping cost PER ITEM?

That’s easy, let’s go back to our shipping methods and edit each of them then enter this:

using formula to calculate flat rate shipping cost

Now, if I go to the cart page, surely I’ll see the shipping cost is calculated for all items in cart:

cart udpated after using formula

Hide flat rate shipping if free shipping is enabled

You may want to reward the customers by offering free shipping to all order exceeds $300. In this case, you also want to hide other flat rate shipping methods. What can you do to achieve this?

You’ll need to enter some code. Don’t worry, it won’t be hard.

First thing first, you need to create a child theme if you haven’t got one. Why do you need a child theme? How to create one? Find all the answers here

Now you have your child theme ready. Let’s go to its functions.php file and paste the following code:

 

function bc_hide_shipping_when_free_is_available( $rates ) {
  $free = array();
  foreach ( $rates as $rate_id => $rate ) {
    if ( 'free_shipping' === $rate->method_id ) {
      $free[ $rate_id ] = $rate;
      break;
    }
  }
  return ! empty( $free ) ? $free : $rates;
}
add_filter( 'woocommerce_package_rates', 'bc_hide_shipping_when_free_is_available', 100 );

add code to functions.php to hide other shipping methods when free shipping available

Click on update file and let’s go to the cart page, you’ll see that if free shipping is available, all other methods are hidden:

other shipping methods hidden when free shipping available

Conclusion

As you can see, flat rate shipping at first seems to be rigid and hard to customize. However, when combine with shipping classes and free shipping method, you can offer very flexible shipping options for your customers. Using shipping classes enables you to set the max shipping fee for an order, set the shipping fee based on the quantity and the total of the cart.