Al crear una web con WP y WooCommerce, en Google Search Console me ha dado errores con los productos y la compañía respecto al Schema.
Al final lo he conseguido encontrar con el plugin de pago de Rankmath. Pero no hace falta ponerlo así. Se puede conseguir con snippets o código.
Aquí se pueden ir probando mejor que en Google Search Console: https://search.google.com/test/rich-results?hl=es-419
Este es el código que puse:
César Frisa Pérez – WooCommerce y SEO – aggregateRating
add_filter('rank_math/snippet/rich_snippet_product_entity', function ($entity) {
$score = 5; //get_post_meta(get_the_ID(), 'users_rating', true); // Replace with your rating post meta.
$count = 10; get_post_meta(get_the_ID(), 'users_rating_count', true); // Replace with your rating count post meta.
$entity['aggregateRating'] = array(
'@type' => 'aggregateRating',
'ratingValue' => $score,
'ratingCount' => $count,
);
return $entity;
});
César Frisa Pérez – WooCommerce y SEO – OfferShippingDetails MerchantReturnPolicy
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
// Return policy
$entity['offers']['hasMerchantReturnPolicy']['@type'] = 'MerchantReturnPolicy';
$entity['offers']['hasMerchantReturnPolicy']['applicableCountry'] = 'ES';
$entity['offers']['hasMerchantReturnPolicy']['returnPolicyCountry'] = 'ES';
$entity['offers']['hasMerchantReturnPolicy']['returnPolicyCategory'] = 'https://schema.org/MerchantReturnFiniteReturnWindow';
$entity['offers']['hasMerchantReturnPolicy']['merchantReturnDays'] = 0;
$entity['offers']['hasMerchantReturnPolicy']['returnMethod'] = 'https://schema.org/ReturnByMail';
$entity['offers']['hasMerchantReturnPolicy']['returnFees'] = 'https://schema.org/FreeReturn';
$entity['offers']['hasMerchantReturnPolicy']['refundType'] = 'https://schema.org/FullRefund';
// Shipping details
$entity['offers']['shippingDetails']['@type'] = 'OfferShippingDetails';
$entity['offers']['shippingDetails']['shippingRate']['@type'] = 'MonetaryAmount';
$entity['offers']['shippingDetails']['shippingRate']['value'] = 5;
$entity['offers']['shippingDetails']['shippingRate']['currency'] = 'EUR';
$entity['offers']['shippingDetails']['shippingDestination']['@type'] = 'DefinedRegion';
$entity['offers']['shippingDetails']['shippingDestination']['addressCountry'] = 'ES';
$entity['offers']['shippingDetails']['deliveryTime']['@type'] = 'ShippingDeliveryTime';
$entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['@type'] = 'QuantitativeValue';
$entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['minValue'] = 0;
$entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['maxValue'] = 1;
$entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['unitCode'] = 'DAY';
$entity['offers']['shippingDetails']['deliveryTime']['transitTime']['@type'] = 'QuantitativeValue';
$entity['offers']['shippingDetails']['deliveryTime']['transitTime']['minValue'] = 0;
$entity['offers']['shippingDetails']['deliveryTime']['transitTime']['maxValue'] = 3;
$entity['offers']['shippingDetails']['deliveryTime']['transitTime']['unitCode'] = 'DAY';
return $entity;
});
Enlaces donde encontré información:
https://rankmath.com/kb/how-to-add-php-code-to-wordpress-post-or-page/
https://rankmath.com/kb/aggregate-rating-error/
https://support.rankmath.com/ticket/how-to-add-shippingdetails-and-hasmerchantreturnpolicy-fields-in-rank-math-schem/
https://rankmath.com/kb/aggregate-rating-error/
https://www.google.com/search?q=schema+product+shipping+details+rankmath&sca_esv=640dfa46d8859720&sxsrf=ADLYWIK1Tsf95c23HoGi1IhXwaKzrJ_bFw%3A1729855502623&ei=DoAbZ9zPJf-lkdUPrPft0Qg&oq=schema+product+shipping+details+&gs_lp=Egxnd3Mtd2l6LXNlcnAiIHNjaGVtYSBwcm9kdWN0IHNoaXBwaW5nIGRldGFpbHMgKgIIADIFECEYoAEyBRAhGKABMgUQIRigAUjQ0B5QkakeWK_JHnAEeAGQAQCYAaQBoAHVEqoBBDAuMTi4AQPIAQD4AQGYAhagArsTwgIKEAAYsAMY1gQYR8ICBhAAGBYYHsICCBAAGBYYHhgPwgIIEAAYgAQYogTCAgUQIRifBcICBBAhGBWYAwCIBgGQBgiSBwQ0LjE4oAeBRg&sclient=gws-wiz-serp
https://www.google.com/search?q=ejemplo+aggregaterating+ratingValue&oq=ejemplo+aggregaterating+ratingValue&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIJCAEQIRgKGKAB0gEJMTU4NTlqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-8
https://developers.google.com/search/docs/appearance/structured-data/review-snippet?hl=es-419
https://ralfvanveen.com/es/tecnologia/mi-introduccion-a-la-revision-de-datos-estructurados/
https://www.google.com/search?q=rich_snippet_product_entity+shippingDetails&oq=rich_snippet_product_entity+shippingDetails&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIJCAEQIRgKGKAB0gEIODkyOWowajeoAgCwAgA&sourceid=chrome&ie=UTF-8
https://rankmath.com/kb/merchant-return-and-shipping-policy/
Información sobre schema
https://developers.google.com/search/docs/appearance/structured-data/product-snippet?hl=es
https://developers.google.com/search/docs/appearance/structured-data/review-snippet?hl=es#guidelines
https://developers.google.com/search/docs/appearance/structured-data/review-snippet?hl=es#aggregated-rating-type-definition
