• Janae

    (@janaeniellgmailcom)


    I’m wondering if there’s a way to have variable information on a single product page in Woocommerce based on which category the product is in? Here is a link to the main shop page so it’s easier to describe elements I’m talking about: https://jamminjdcards.com/blog/shop/ Sadly I don’t have any products up right now to demonstrate the single product page with – only on my localhost.

    Anyway, basically I’d like the title of the page and the sub-navigation (categories, account, cart that you see in the link above) be dependent on which category the product is in. For example the categories drop-down is not necessary on single card products, but it does apply to box break pages/products. So I’d either want the drop-down to have different options or just be taken out altogether. Similarly I’d like the title to reflect the category: “Box Breaks” or “Single Cards” as an example.

    Right now I have the title and the categories sub-navigation placed in my product-image.php template file for woocommerce. Here is a copy of it on pastebin:

    https://pastebin.com/gRgT4WRf

    I tried writing a simple if then statement to echo a different title dependent on the category, but I don’t pretend to be great at php and probably did it wrong. Also, I’m not sure if an if then statement is the appropriate way to solve this issue.

    Hopefully this makes sense – please let me know if I need to clarify more.

  • The topic ‘Variable Information on Single Product Page’ is closed to new replies.