Category link on product grid

#780204
  • Resolved Javi24
    Rank Math free

    Hello

    Can you tell how to display only the primary category on the product grid in woocommerce?

    Thanks for the help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    To display only the primary category on the product grid in WooCommerce, you can follow these steps:

    1. Set the Primary Category: Ensure you have set the primary category for each product. You can do this by editing each product and selecting the primary category using Rank Math SEO.

    2. Customize the Product Grid: Modify your product grid template to display only the primary category. You can use the following code snippet to retrieve and display the primary category:

    $primary_category = get_post_meta( get_the_ID(), 'rank_math_primary_category', true );
    if ( ! empty( $primary_category ) ) {
        echo '' . get_cat_name( $primary_category ) . '';
    }

    Replace get_the_ID() with the appropriate product ID in your template.

    If you need further assistance or have any questions, please feel free to ask.

    Thank you for reaching out!

    Sources:
    How to Choose a Primary Category » Rank Math
    How to Choose a Primary Category » Rank Math
    Remove All Schema from Product Category Pages » Rank Math
    Remove All Schema from Product Category Pages » Rank Math
    How to Use Product Schema for WooCommerce Products » Rank Math

    Javi24
    Rank Math free

    Hello

    The desire is to display the main/primary category on the category page for all products.

    Hello,

    Thank you for contacting support.

    It seems that you are talking about the content in the product cards. That is controlled by the theme and not by our plugin so you would need to get in touch with the theme provider to ask how to perform those modifications.

    Don’t hesitate to get in touch if you have any other questions.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Category link on product grid’ is closed to new replies.