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.
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
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).
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).
- Replaced outdated `priceSpecification` with `AggregateOffer`.
- Restructured data according to Google's latest specifications.
- Use product short_description if available.
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'