Merge pull request #22344 from woocommerce/fix/breadcrumbdata
Product structured data tweak to show both BreadcrumbList and Product structured data.
This commit is contained in:
commit
9ce3f408a6
|
@ -329,6 +329,12 @@ class WC_Structured_Data {
|
|||
$markup['itemListElement'] = array();
|
||||
|
||||
foreach ( $crumbs as $key => $crumb ) {
|
||||
// Don't add the current page to the breadcrumb list on product pages,
|
||||
// otherwise Google will not recognize both the BreadcrumbList and Product structured data.
|
||||
if ( is_product() && count( $crumbs ) - 1 === $key ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$markup['itemListElement'][ $key ] = array(
|
||||
'@type' => 'ListItem',
|
||||
'position' => $key + 1,
|
||||
|
|
Loading…
Reference in New Issue