简体   繁体   中英

bigcommerce display a product's categories on product display page

Looking to display all the categories that the specific product is in, on it's product display page. (in code for all products of course)

trying to get stencil's code for displaying like:

each top level category and then the subcategories within it. I have tried code for categories, but not seeming to work on product page.

You can list out the categories that a product is in on the PDP using product.category . However, since this is an array, you will probably want to loop through it and give it some formatting. Here is an example:

<ul>
  {{#each product.category}}
    <li>{{this}}</li>
  {{/each}}
</ul>

Reference: https://developer.bigcommerce.com/theme-objects/product

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM