Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Dee Barizo
Dee Barizo
8,402 Points

Can you create a plugin that changes custom fields of a certain WooCommerce product?

I have WooCommerce products with a custom field that matches a category.

The products are actually virtual courses. The course content are posts organized by category. The category matches the product.

So for example, one Product is called Foo Course. When someone buys it, they get access to the posts in Foo category. The posts in this category are the course content for the Foo Course.

I want to create a plugin that lists all the products and then it has a dropdown menu where I can choose a category for each product. Then, when I click update, the product's custom field is changed to the category ID of the category I chose in the dropdown menu.

Is this possible? And is this a standard way of doing these actions or is there a better way? Thanks.