Easy Digital Downloads
[resolved] Changing styles based on category (4 posts)

  1. awwnuts
    Posted 1 year ago #

    What I am attempting to do is add an if statement to check the category of the product, then change the border color around it based on the category.

    I do not know what command to use to get the category though?

    if($product_category == "143"){do this};

    I dont know what I need to do to set the correct variable into the $product_category.....

    I will have 3 main categories that my products fall into. They are the main parents to many sub categories.

    TLDR; What function or existing variable can I use to know my products category?


  2. You can use this:

    if( has_term( 143, 'download_category' ) ) {
        // do something
  3. awwnuts
    Posted 1 year ago #

    Very cool. Works great!


  4. Great!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Easy Digital Downloads
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic