Only current subcategory in related products

#562663
  • Resolved Dre
    Rank Math free

    I found this thread on how to only include primary product category products in the related products, but how can I only inlcude the current sub categories’ products? For example, I have a product “Shirt” in the parent category “Tops” and the grandparent category “Clothing”. If I view another product which is also in “Clothing” but not in “Tops”, it should not be in the related products on the “Shirt” single product page.

    Thank you!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Nigel
    Rank Math business

    Hello,

    Thank you for contacting Rank Math for help with setting only products with the same subcategory to be related products.

    I found the following guide to set products with same subcategory as related products: https://www.blazeconcepts.co.uk/2020/10/woocommerce-related-products-show-only-same-sub-category/

    Hope that helps. Please let us know if you have questions.

    Dre
    Rank Math free

    Thank you, but unfortunately that snippet does not work – I had already tried it before, ad still products of the same parent category are displayed in the relate products, even after a 24 h wait(to have transients cleared).

    Hello,

    You can select your sub-category as the primary category of the products and use the filter shared here to make it work: https://wordpress.org/support/topic/pull-related-products-from-primary-category-only/#post-16018668

    However, if you don’t want to change the primary category then you should get in touch with the support of WooCommerce as they will be in a better position to help you with this.

    Don’t hesitate to get in touch in case you need our assistance with anything else.

    Dre
    Rank Math free

    Is there a way to bulk edit primary term of the products? Is there a meta filed that can be xported via the default Woocommerce product exporter?

    Alhan
    Rank Math free

    Hello,

    Although meta data cannot be exported via the default Woocommerce product exporter, we have the Import-Export options in Rank Math PRO.

    Rank Math PRO does allow you to export the SEO metadata and bulk editing of posts, terms, and even users to a CSV file.

    We have a dedicated knowledgebase article to help you take advantage of the import & export and bulk editing CSV feature of Rank Math PRO.

    Learn more about Import & Export CSV / Bulk Editing Options in Google Sheets or Excel

    Feel free to check out the simple pricing plans and compare the free version with the paid versions of Rank Math :

    We hope that helps, and please don’t hesitate to get in touch if you have any other questions.

    Thank you.

    Dre
    Rank Math free

    The Woo default imprter and exporter DOES allow to import/export meta data. And I did find the corresponding meta field there.

    Hello,

    Rank Math stores the primary category under the primary_term field in our CSV:
    https://rankmath.com/kb/editing-seo-meta-at-scale/#num-3-10-primary-term

    You can also share the meta field you’re referring to so we can check. If you wanted to share a file, you can upload it using this tool and share the link here: https://wetransfer.com

    Looking forward to helping you.

    Thank you.

    Dre
    Rank Math free

    Thanks, but like I mentioned if you use the default Woo exporter you can export meta fileds and the primary term from Rank Math is included in that.

    Hello,

    In that case, let us know if that helps you apply the Rank Math primary category for your pages.

    In the meantime, please do not hesitate to let us know if you need our assistance with anything else.

    Thank you.

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

You must be logged in to reply to this ticket.