Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Pcosta88 opened this issue Feb 12, 2019 · 11 comments

Comments

@Pcosta88
Copy link
Contributor

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
Copy link
Contributor Author

related #12156

@jonoalderson
Copy link

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?

@Pcosta88
Copy link
Contributor Author

Pcosta88 commented Feb 14, 2019

@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

@jonoalderson
Copy link

Well, that should work, I think! Bug!

@Pcosta88 Pcosta88 changed the title [Enhancement] Provide a template variable for a parent product category Template variable for a parent product category %%ct_product_cat%% fails to be outputted on sub product category pages Feb 14, 2019
@monbauza
Copy link

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 #6527 but it was closed at that time.

@monbauza
Copy link

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

@mayada-ibrahim
Copy link

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

@maybellyne
Copy link

@jan-caerels
Copy link

+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.

@josevarghese
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants