Commit Graph

126 Commits

Author SHA1 Message Date
Yaku 9191068068 Added missing schema markup
Take 3. Aanhouer wen. Viewed invisible to compare my changes to the rest of the doc. All seems the same now.
2020-02-14 10:51:41 +02:00
Yaku 816b3b3251 Added missing schema markup
Second attempt, fixed spacing of previous added values
2020-02-14 10:18:37 +02:00
Yaku 0a24ea44ea Update class-wc-structured-data.php
Adds bestRating and worstRating where requried as per Schema.org
2020-02-13 22:18:58 +02:00
Rodrigo Primo 487f96d844 Fix WordPress.DateTime.CurrentTimeTimestamp vilations
This commit fixes all violations of the WordPress.DateTime.CurrentTimeTimestamp sniff automatically using phpcbf.
2019-12-20 14:23:05 -03:00
Peter Fabian 8379e46772
Merge pull request #24278 from woocommerce/fix/23299
Display schema for the latest 5 reviews inside product's schema
2019-11-27 17:56:54 +01:00
Claudio Sanches dd97b00815 Added "reviewBody" to review schema
Update get_comment_* functions args
2019-11-18 11:47:56 -03:00
Claudio Sanches 237a047e26 Removed itemReviewed since is already nested to Product schema 2019-10-22 18:00:25 -03:00
Claudio Sanches 3c92523d92 Fixed comments orderby 2019-10-01 18:04:18 -03:00
Claudio Sanches d9dc4fd82e Display schema for the latest 5 reviews inside product's schema 2019-07-31 17:15:09 -03:00
Rodrigo Primo 0e317ac82e Only add the image node to structured data if product has image
This commit adds a check to verify if a given product has a image before
adding the image node to the structured data output. If there is no
image, the image node should be omitted instead of display with `false`
as its value.
2019-07-18 10:24:42 -03:00
Jonathan Moore 5d6574a00a
rating optional = generate_product_data incorrect
If rating is not mandatory on comments, generate_product_data() produces incorrect output.
For example items with comments but no reviews are output with rating of zero which is getting flagged in google webmasters tools under the heading "Rating is missing required best and/or worst values".

The output google is objecting to is eg:
"aggregateRating":{"@type":"AggregateRating","ratingValue":"0","reviewCount":1}}

postmeta in this case is:
_wc_average_rating 0
_wc_rating_count 0.0
_wc_review_count 1

product lookup table is reporting
rating_count 0
average_rating 0.00

the meta is correct and reflected in the product object, it is the test that is wrong since
if $product->get_review_count() 
may be true even if there are no ratings.

This is solved by substituting get_rating_count() which has the correct number of ratings.
2019-05-28 07:38:07 +01:00
Karoly Gossler a135f02f41
fixed availability schema protocol
As you can see in the example, the scheme only can be on http:
https://schema.org/InStock
The Google Search console has also marked it invalid.
2019-05-21 09:10:56 +02:00
Hassan Yousefi a50464d781 WC_Structured_Data::generate_product_data() no more hooked in to woocommerce_shop_loop ,which has been removed in #22912 2019-05-11 20:45:54 +04:30
Claudio Sanches 669542ed7d Adds offerCount to variable product's structured data 2019-04-17 14:04:52 -03:00
Mike Jolley 545cbbb79c Check for required fields or bail 2019-03-05 11:44:26 +00:00
Mike Jolley bf11dbf76f If there is no url on last breadcrumb trail, use current url
Fixes #22923
2019-03-05 11:38:53 +00:00
Mike Jolley 8147b82b88 Feedback 2019-03-04 14:17:11 +00:00
Mike Jolley 5937625b5e Include priceValidUntil 2019-03-04 13:17:27 +00:00
Mike Jolley 246c78db73 Add a review to product schema 2019-03-04 13:05:29 +00:00
Mike Jolley d104bb7d3f Add SKU with ID fallback 2019-03-04 12:47:40 +00:00
Mike Jolley 52533d9da6 Add URL field 2019-03-04 12:47:31 +00:00
Mike Jolley 6caa0fab61 Tidy data 2019-03-04 12:47:24 +00:00
Mike Jolley 60d8a10bcf Remove woocommerce_structured_data_product_limit
With the removal of generation on archives, the filters `woocommerce_structured_data_product_limit` and `woocommerce_structured_data_product_limited` have no context nor purpose. This commit removes them so full schema is generated when used.
2019-03-04 11:44:52 +00:00
Tim Howe 41de832580 #22912 2019-03-04 11:11:04 +00:00
Claudio Sanches 80aee99fee Prevent a few structured data warnings
This prevents warnings about 'image', 'description' and 'sku'.
'brand' included as empty fields just to register.

Note that warnings still comes for empty fields like 'sku' or 'brand'.
This is the message that should throw from Google Console:

> The brand field is recommended. Please provide a value if available.

Since is recommended, this PR should solve the max warnings as possible.

Fixes #22842
2019-02-25 15:49:14 -03:00
Mike Jolley 7def966e4f Impoved JSON handling 2019-02-20 12:00:47 +00:00
Mike Jolley 592e0abe22 Merge branch 'pr/22596' 2019-02-05 11:02:29 +00:00
Mike Jolley d082c7dfa5 Swap to wp_strip_all_tags 2019-02-05 11:02:21 +00:00
Boost d9c971ee20 Update class-wc-structured-data.php. Line 214, changed wpautop to wp_filter_nohtml_kses 2019-01-29 13:27:05 +00:00
claudiulodro 78e5189334 Better @id generation for product structured data 2019-01-24 11:49:44 -08:00
Gerhard f3d9eeeef3 Introduce wc_reviews_enabled, wc_review_ratings_enabled and wc_review_ratings_required as helper functions and update all places where options are accessed directly. 2019-01-17 08:04:57 +02:00
claudiulodro 5a005d9ee9 Product structured data tweak 2019-01-04 07:51:22 -08:00
Gerhard Potgieter 55b188ad8f
Merge pull request #21111 from woocommerce/fix/structured-data-breadcrumbs
Include URL for the last element in breadcrumb list
2018-09-12 12:45:23 +02:00
Rodrigo Primo e1ac6317da Include URL for the last element in breadcrumb list
I noticed that the structured data generated by WooCommerce doesn't pass Google Structured Data validation (https://search.google.com/structured-data/testing-tool) due to the following error in the last element of the BreadcrumbList:

"The value provided for item.id must be a valid URL."

This happens because the code was explicitly omitting the URL for the last element. This commit simply removes this check and now an URL is included for every element (unless there is no URL set).
2018-08-20 18:02:38 -03:00
Rodrigo Primo 5e7c8c6959 Remove unneeded call to wc_clean() when outputting product structured data
This commit removes an unneeded call to wc_clean() before outputting product structured data to the browser. wp_json_encode() is called before the data is sent to the browser and it should be enough to escape it. wc_clean(), which calls sanitize_text_field() internally, was causing issues with the product URL when its name contained some non-ASCII characters (see #21057 for examples of characters).
2018-08-20 14:48:17 -03:00
Mike Jolley ffb6bc844c Use `get_variation_price` method in structured data to grab min/max so filters are ran.
Closes #19519
2018-03-26 12:54:17 +01:00
Claudio Sanches 539282be16 Fixed includes/class-wc-structured-data.php PHPCS violations 2018-03-21 00:19:41 -03:00
Mike Jolley 3265f594d8 Only add schema for ratings when enabled. 2018-03-08 13:03:58 +00:00
Mike Jolley 964afd3882 Include priceSpecification with valueAddedTaxIncluded
Closes #18852
2018-02-22 16:34:54 +00:00
Jason Kytros 55c664d2d7 Remove filter 'woocommerce_order_item_product' from class-wc-structured-data.php 2018-01-31 14:53:44 +02:00
Mike Jolley 1c92b970a9 Use only review count
Closes #18558
2018-01-23 11:03:30 +00:00
Mike Jolley 16870a30e7 phpcs 2018-01-11 12:32:58 +00:00
Mike Jolley 7a50512e16 Structured data 2018-01-11 12:29:12 +00:00
Mike Jolley 866f1cd818 Merge branch 'master' into pr/16191
# Conflicts:
#	includes/wc-account-functions.php
2017-08-08 13:20:17 +01:00
Claudiu Lodromanean ab543148ff Merge pull request #16335 from woocommerce/fix/16309
Add shortcode to description output in structured data
2017-08-03 11:09:16 -07:00
Mike Jolley 827083c051 Add shortcode to description output in structured data
Closes #16309
2017-08-03 08:28:35 +02:00
opportus f448c692ca Fixes #16010
Allows single SD item having a `@context`
2017-08-01 14:32:40 +02:00
Saul Fautley 68470b51a4 Updated structured data for products
- Replaced outdated `priceSpecification` with `AggregateOffer`.
- Restructured data according to Google's latest specifications.
- Use product short_description if available.
2017-07-19 18:53:02 +02:00
Mike Jolley d7ed343178 Revise where context is added. 2017-07-07 11:20:34 +01:00
claudiulodro fe09b4cf54 Remove side-effects 2017-07-03 13:57:32 -07:00