wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Template variable for a parent product category %%ct_product_cat%% fails to be outputted on sub product category pages

Open Pcosta88 opened this issue 6 years ago • 11 comments

Is your feature request related to a problem? Please describe.

Users want to output the parent product category in the title of a sub product category

Describe the solution you'd like

Users must manually enter in the parent product category. We should provide template variable for a parent product category.

Note, the parent title variable does not work: https://kb.yoast.com/kb/yoast-wordpress-seo-titles-metas-template-variables/.

why you think the feature request is something we should consider for the Yoast SEO plugins?

Improve UX and Content SEO

Pcosta88 avatar Feb 12 '19 15:02 Pcosta88

related https://github.com/Yoast/wordpress-seo/issues/12156

Pcosta88 avatar Feb 12 '19 15:02 Pcosta88

Hmm. I think this one is slightly different to #12156. If I'm reading this right, the challenge is:

"I have a product called 'red sock' in WooCommerce, categorised in 'footwear'. I want the title to be Red sock > Footwear | Brandname".

In this case, %%parent_title%% won't correctly return 'Footwear', but that's expected behaviour - this isn't a 'child post', it's a product in a category - so %%parent_title%% isn't populated.

We have %%ct_product_cat%% for WooCommerce categories; does that solve it?

jonoalderson avatar Feb 13 '19 15:02 jonoalderson

@jono-alderson Nope.

1. Add a product category as a subcategory. In this example: Hats

screen shot 2019-02-14 at 8 16 39 am

2. Add the %%ct_product_cat%% template variable

screen shot 2019-02-14 at 8 16 17 am

3.See that the parent product category fails to be outputted

screen shot 2019-02-14 at 8 16 26 am

Pcosta88 avatar Feb 14 '19 13:02 Pcosta88

Well, that should work, I think! Bug!

jonoalderson avatar Feb 14 '19 13:02 jonoalderson

I think the %%ct_product_cat%% is expected to output all the categories assigned to a product. Since we'd like to output the name of the parent product category in the title of the child category, a template variable like %%parent_title%% should be used in this case. However, this variable seems to work only with pages not with taxonomies.

A similar feature request was submitted some time ago https://github.com/Yoast/wordpress-seo/issues/6527 but it was closed at that time.

monbauza avatar Mar 22 '19 07:03 monbauza

Please inform the customer of conversation # 486296 when this conversation has been closed.

monbauza avatar Mar 22 '19 07:03 monbauza

Please inform the customer of conversation # 551730 when this conversation has been closed.

mayada-ibrahim avatar Oct 22 '19 17:10 mayada-ibrahim

https://wordpress.org/support/topic/display-parent-category-on-sub-category-page/

michaelbriantina avatar Nov 27 '20 06:11 michaelbriantina

+1 https://wordpress.org/support/topic/primary-category-not-shown-in-meta-title/

maybellyne avatar Aug 07 '23 13:08 maybellyne

+1 Sadly still not fixed, I've had this issue since 2020. For products, I set the SEO title something like (loosely translated): %%title%% - %%ct_product_cat%% | %%website title%%

This however outputs not the primary category, but ALL the categories that the product is assigned to. Imagine a (tile) product named "Box grey", being in the categories "floor tiles", "ceramic floor tiles", "concrete look tiles", "terrace tiles", "ceramic terrace tiles". The output of %%ct_product_cat%% is all those categories.

jan-caerels avatar May 30 '24 20:05 jan-caerels

Hi @jan-caerels

As mentioned in our help center for the snippet variables, %%ct_product_cat%% will output all the categories that are selected for the product page separated by commas.. So the result you have noticed is an expected result.

This issue is about outputting the parent category name when the %%ct_product_cat%% is used on a child product's category page and not on the product page.

josevarghese avatar Jun 05 '24 08:06 josevarghese