-
Hello, I tested your code to add the brand but it does not work
/**
* Filter to add custom Brand for WooCommerce Products.
*/
add_filter(‘rank_math/snippet/rich_snippet_product_entity’, function( $entity ) {
$entity[‘brand’] = ‘Rank Math’;
return $entity;
}
);
-
Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. Iām sorry for any inconvenience this issue may have caused you.
From the code you have provided, it seems that you didn’t update the Brand value.
You should update the word Rank Math in line
$entity[ābrandā] = āRank Mathā;
to your actual brand name.And hereās a guide on how you can add a filter to your website:
https://rankmath.com/kb/filters-hooks-api-developer/I hope that helps.
Thank you, and please donāt hesitate to contact us anytime if you need further assistance with anything else.
mi code and folder rank-math.php
I have mi in both files and made several tests and its not working rank-math.php functions.php
I have not seen any positive response in your help forums
<?php
/**
* Filter to add custom Brand for WooCommerce Products.
*/
add_filter(‘rank_math/snippet/rich_snippet_product_entity’, function( $entity ) {
$entity[‘brand’] = ‘French Baskets’;
return $entity;
}
);I have 3 woocommerce site same problem
Hello,
Could you please share a sample product URL to check? You can add it in the sensitive data section
It is completely secure, and only our support staff has access to that section.
Looking forward to helping you.
Thank you.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello,
We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress logins in the designated Sensitive Data section.
Please do take a complete backup of your website before sharing the information with us.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping you.
Hello I donāt have an answer?
I have the feeling that the free version of your module does not allow the display of the brand in woocommerce products I preferred an honest rapunzel
Hello,
It seems that you have missed my colleague’s reply above. Please follow the instructions so we can investigate this issue further.
Looking forward to helping you.
Thank you.
Please see the repair of the module and explain to me the problem that I can repair on but 2 other site
Hello,
Could you please also share the URL of the login page so that we can investigate the issue further?
Really looking forward to helping you.
Thank you.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Thank you I have added the url in the hidden part
I think I have solved but problem with your module I found its code on your help forum and it repaired the brand and the gtin
add_filter( ‘rank_math/snippet/rich_snippet_product_entity’, function( $entity ) {
global $product;
if ( isset( $entity[‘aggregateRating’] ) ) {
if ( $entity[‘aggregateRating’][‘ratingValue’] > 5 || $entity[‘aggregateRating’][‘ratingValue’] <= 1 ) {
$entity[‘aggregateRating’][‘ratingValue’] = 5;
}
}
$brand = $product->get_attribute(‘pa_marca’);
$brands = explode( ‘,’, $brand );
if ( ! empty( $brands ) ) {
$marca = $brands[0];
}else{
$marca = ‘French Baskets’;
}
$entity[‘brand’] = array(
‘@type’ => ‘Brand’,
‘name’ => $marca,
);
// We use product Gtin codebar as our sku. No need to add another field, just fill from there
$entity[‘gtin13’] = $product->get_sku();
return $entity;
} );Hello,
Glad that you were able to resolve the issue.
Please let us know if you need our assistance with anything else.
Looking forward to helping you.
Thank you.
No Sorry
the code does not work well
he but all in green
but don’t change the gtin to sku and don’t give the mark
can you give me a code which but all but produced with a single brand and transform the gtin into sku thank you
The ticket ‘Brand for WooCommerce Products’ is closed to new replies.