- WooCommerce Cookbook
- Patrick Rauland
- 403字
- 2021-07-23 19:35:08
Adding a variable product
One of the complexities of e-commerce stores is figuring out how to sell similar products; for example, the same t-shirt design in different sizes and colors. Do you sell each size and color as a separate product with its own product page or do you combine them somehow?
WooCommerce handles this with variable products. Variable products can have multiple attributes such as size and color to help you sell these products. Throughout this chapter, I've been creating a poster product and attributes. I'm going to use the same data in this recipe as well, except that this time I'm going to create a variable product so people can choose the color of the poster.
Getting ready
You'll need to have set up global product attributes in the preceding recipe.
How to do it…
There are two basic parts to this. The first part is setting up the attributes this variation will use to distinguish between the different variations. The second part will define how each variation is different.
- From the WordPress admin, go to Products | Add Product.
- Just as with a simple product, add the Product name and Featured Image.
- Scroll down to the Product Data panel and, from the drop-down, select Variable product. You may notice a few of the settings in the panel have been moved around.
- Click on the Attributes tab. You have to add attributes before you can add variations.
- Select one of the global product attributes we created in the previous recipe and click on Add.
- The poster I'm creating comes in blue and red. I'm going to select those attribute terms.
- Click on the Used for variations checkbox.
- Click on the Save attributes button.
By this point, we've told WooCommerce the attributes we're using to distinguish between the different variations. Now it's time to create our variations and tell WooCommerce how each one is different.
- Click on the Variations tab in the Product Data panel.
- Click on Add Variation.
- Select your attribute in the drop-down, enter a price, and upload an image for that variation.
- Repeat this for as many variations as you have. For my example, I'll be doing it one more time for the red variation.
- Once you're all done, click on Publish.

- vSphere High Performance Cookbook
- WSO2 Developer’s Guide
- C語言程序設計
- 深入理解Java7:核心技術與最佳實踐
- Learn Swift by Building Applications
- Mastering Unity Shaders and Effects
- Mastering RStudio:Develop,Communicate,and Collaborate with R
- Python機器學習編程與實戰
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- Node.js全程實例
- Microsoft 365 Certified Fundamentals MS-900 Exam Guide
- Django 5企業級Web應用開發實戰(視頻教學版)
- Docker:容器與容器云(第2版)
- Continuous Delivery and DevOps:A Quickstart Guide Second Edition
- Android應用開發攻略