Commit Graph

112 Commits

Author SHA1 Message Date
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
claudiulodro 6706da6d45 Move to prevent undefined errors 2017-06-29 11:46:30 -07:00
claudiulodro 0db60b56c9 Re-add removed line. 2017-06-29 11:43:30 -07:00
Jonathan Moore 7dc2c7cd6e fixes #15283
fixes #15283 Notice: Undefined property: stdClass::$post_ID in wp-content/plugins/woocommerce/includes/class-wc-structured-data.php on line 262 
when calling wp_list_comments with $options['callback'] = 'woocommerce_comments'
2017-05-26 07:59:42 +08:00
Mike Jolley e0583d2cd9 Merge branch 'master' into update/14848
# Conflicts:
#	includes/class-wc-structured-data.php
2017-05-08 19:13:12 +01:00
Claudio Sanches ec5df6450c Merge pull request #14931 from woocommerce/fix/14854
Hide offers from structured markup when blank
2017-05-08 14:01:58 -03:00
Mike Jolley 3c57508f56 Correct variable name in order structured data
Fixes #14944
2017-05-08 17:46:40 +01:00
Mike Jolley 7d956ca797 If prices are the same for all variations, use price not priceSpecification
Closes #14848
2017-05-08 16:53:27 +01:00
Mike Jolley c7e9a4c809 Hide offers from structured markup when blank
Fixes #14854
2017-05-08 11:59:33 +01:00
Mike Jolley d5205b97f8 Abort generate_breadcrumblist_data is there are no crumbs 2017-04-20 17:04:48 +01:00
Brandon Hubbard fe81c3d74b Updated Schema URLs to use HTTPS 2017-04-17 12:35:21 -03:00
Mike Jolley 7bdf8302ec Restores itemReviewed structured data for product reviews 2017-04-13 16:30:06 +01:00
Claudio Sanches 01c425398c Merge pull request #14012 from woocommerce/fix/13930-alt
Hide structured data in hidden element
2017-04-06 10:14:30 -03:00
Mike Jolley 36e9b73ef3 Make sure we have a product before generating JSON 2017-04-06 12:40:53 +01:00
Mike Jolley 52939e800c Hide structured data in hidden element 2017-04-06 10:06:21 +01:00