From the course: WordPress: Customizing WooCommerce Themes

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Declare WooCommerce support

Declare WooCommerce support - WordPress Tutorial

From the course: WordPress: Customizing WooCommerce Themes

Start my 1-month free trial

Declare WooCommerce support

- [Instructor] If you are creating a theme from scratch, using a starter theme, or using a theme that doesn't declare WooCommerce support, you'll see a notice like this in the Admin. If you don't wanna see it every day or if you don't want to confuse someone else who will be using the site, you programmatically declare support for WooCommerce. You can do this with a few lines of code. Since this is specific to the theme, we'll want to include it in that theme's functions.php file or child theme's functions.php file. I've opened up my theme's functions.php file in Adam, my code editor. Feel free to use whichever code editor that you like to work with. We'll be using the hook system to let WordPress know that our theme supports WooCommerce. The first thing we need to do is add a hook right after our theme loads. We can do that with add_action, and then 'after_setup_theme'. Once we have that typed in, we need to add our own function that runs right after this add setup theme. And we can…

Contents