Merge pull request #22852 from woocommerce/fix/22842

Prevent a few structured data warnings on product catalog
This commit is contained in:
Mike Jolley 2019-02-27 12:32:28 +00:00 committed by GitHub
commit 504e457c31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -203,6 +203,11 @@ class WC_Structured_Data {
'name' => $product->get_name(),
);
$markup['image'] = wp_get_attachment_url( $product->get_image_id() );
$markup['description'] = wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) );
$markup['sku'] = $product->get_sku();
$markup['brand'] = '';
if ( apply_filters( 'woocommerce_structured_data_product_limit', is_product_taxonomy() || is_shop() ) ) {
$markup['url'] = $permalink;
@ -210,10 +215,6 @@ class WC_Structured_Data {
return;
}
$markup['image'] = wp_get_attachment_url( $product->get_image_id() );
$markup['description'] = wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) );
$markup['sku'] = $product->get_sku();
if ( '' !== $product->get_price() ) {
if ( $product->is_type( 'variable' ) ) {
$lowest = $product->get_variation_price( 'min', false );