Tagged: schema
-
AuthorPosts
-
September 26, 2019 at 9:04 pm #1142494
Hey guys,
Just completed a site build using custom products with the ALB and have finally realised that the product schema is entirely missing.
It’s the same on your demo site.
Using the Structured Data testing tool from Google: https://search.google.com/structured-data/testing-tool you can see that in your normal product found here: https://kriesi.at/themes/enfold-shop/product/woman-blazer-anadra/ the schema is included for a Product.
However, run the custom product found here: https://kriesi.at/themes/enfold-shop/product/red-velvet/ through the same tool and it doesn’t register as a product at all.
This is now the problem I am facing on my site (in the private field below). All my products made using the ALB as custom products show zero product schema. The exact same theme, plugins etc are running on one of my other sites (2nd one in the private field) and the only difference is these are standard (non ALB) products, and they have schema being output correctly.
Please help me with this one, as the custom product is quite useless these days without any product schema associated with it!
Cheers
Tim
September 30, 2019 at 9:58 am #1143256Same issue. Product schema is not available when Advanced Editor is used for products. Is there quick fix for this case?
September 30, 2019 at 10:47 am #1143279Hey THP,
Thank you for the inquiry.
The JSON+LD schema markup should be added to the product even when it’s set to use the advance layout builder, but it’s not working in your installation. Please try this snippet in the functions.php file.
add_action('wp_footer', function() { if( ! avia_woocommerce_version_check( '3.0.0') ) { return; } if( is_product() && get_post_meta( get_the_ID(), '_aviaLayoutBuilderCleanData', true ) ) { WC()->structured_data->output_structured_data(); } }, 10);
We’ll notify the dev team about the issue. You can also use the following plugin temporarily.
// https://wordpress.org/plugins/wpsso/
// https://wordpress.org/plugins/wpsso-schema-json-ld/Best regards,
IsmaelOctober 1, 2019 at 9:00 pm #1143926Hi Ismael,
Thanks for the reply and getting the dev team onto it.
I tried your snippet and cleared caches, but it still doesn’t appear to be working.
The snippet is still in there if you want to test it.
October 1, 2019 at 9:05 pm #1143927Please bear in mind, its not just on my site as you mentioned – your own demo site doesn’t have it either.
Something must have changed theme-wise.
(By the way, REALLY loving your stick of up-coming Enfold changes – thank you very much for listening to our feedback on the need for something like that, I hope it continually gets updated)
- This reply was modified 5 years, 2 months ago by THP Studio.
October 4, 2019 at 5:46 am #1144861Hi,
Thank you for the update.
This line of the code or condition in the structured data function prevents the markup or schema data from being set properly when ALB is active.
// Check we have required data. if ( empty( $markup['aggregateRating'] ) && empty( $markup['offers'] ) && empty( $markup['review'] ) ) { return; }
The ratings, offers and reviews are now required in order to fetch the schema. Now to get around that, you can use the following snippet in the functions.php file.
// https://pastebin.com/KSMaSwLW
It’s a modified version of the product structured data function.
Best regards,
IsmaelOctober 4, 2019 at 10:14 pm #1145148Hey Ismael,
Thank you, I have tried the code and it works (kind of). In the structured data testing tool is isn’t displayed as a Product, although it does contain the product information. And the description section contains all sorts of duplicate and unnecessary information.
I understand what you are saying about having the required information. But I don’t understand the logic behind how it currently works. Let me explain:
If I am selling a product, then surely I want all the product related schema along with it. However, I might like to customise the look of the product – thus why we would use the ALB to build the product page. Using the ALB doesn’t mean I want parts of the product schema missing, just because I won’t be displaying them on the front end. That is just a design choice, not a technical choice.
It would be a lot more logical to me to grab all the related product data and output it regardless of if it will be shown on the front end or not. But perhaps to keep everyone happy, this could simply be an option in the Theme settings or on each product page – “Include all schema markup even if not displayed on front end? Yes/No” type thing.
I hope that makes sense.
Can I ask, is the code you posted to me above the fix for this, or are your devs looking into this some more for better implementation?
Thanks a lot
- This reply was modified 5 years, 2 months ago by THP Studio.
October 7, 2019 at 7:32 am #1145662Hi,
Thank you for the update.
It would be a lot more logical to me to grab all the related product data and output it regardless
The snippet will generate the entire schema markup of a product even when the element related to that markup is not present in the front end. It doesn’t really matter what’s in the builder.
Can I ask, is the code you posted to me above the fix for this, or are your devs looking into this some more for better implementation?
The previous implementation is almost the same, but it’s not working properly because of the condition mentioned above. It doesn’t return the schema when the product is not yet rated.
if ( $product->get_rating_count() && wc_review_ratings_enabled() ) {
Best regards,
IsmaelOctober 14, 2019 at 10:51 pm #1147914Hi Ismael,
I’m sorry, I don’t really understand your response properly.
My basic question is: Is there a fix for this coming?
Adding your snippet still does not allow Google to see the page as a legitimate product.
Thanks
Tim
October 16, 2019 at 6:51 am #1148319Hi,
Thank you for the update.
To clarify, you wanted to grab all the related product data regardless of what is in the frontend. That is exactly what the snippet does. It will output all the related data in the schema markup regardless of what is added in the builder.
My basic question is: Is there a fix for this coming?
We have already reported the issue to the dev team, but they haven’t responded yet. It’s odd that the full URL is used as the @type property when it’s supposed to be “Product”. This is not the case on our own installation. The @type property is correctly set as you can see below.
<script type="application/ld+json">{"@type":"Product","@id":"http:\/\/localhost:8061\/?product=alb-product#product","name":"ALB Product","url":"http:\/\/localhost:8061\/?product=alb-product","image":"http:\/\/localhost:8061\/wp-content\/uploads\/2019\/09\/Abducted-2.jpg","description":"Click here to add your own text\n\r\n\r\nClick here to add your own text","sku":66}</script>
Did you add a structured data from Yoast?
Best regards,
IsmaelOctober 25, 2019 at 10:29 pm #1151298Hi,
Has the dev team responded yet?
I do have Yoast SEO installed, but as in my original posts private details, so does the other site. Both of my sites have the same plugins that would touch Schema. The only difference between the two is one site uses standard WooCommerce product pages, the other one uses custom product pages built with the ALB.
October 29, 2019 at 1:05 pm #1152046Hi,
Sorry for the delay. They haven’t responded to the git issue yet, because they are currently improving the builder and adding new styles to it. Can we access the file server and the dashboard? We would like to check why the @type property is incorrectly set.
Best regards,
IsmaelNovember 25, 2019 at 1:19 am #1159733Hey!
Thanks for waiting. This is what @Guenter posted in our git repo.
==============================================
Nothing specific to ALB products.As far as I checked (WC 3.8) woocommerce\includes\class-wc-structured-data.php:
if ( empty( $markup[‘aggregateRating’] ) && empty( $markup[‘offers’] ) && empty( $markup[‘review’] ) )
If all 3 are empty even on a standard ALB product no structured data is generated.
– Create a new product (standard)
– Only add a description (leave price empty string (not 0)
– Load frontend – show rendered page HTML content – and search for application/ld+json
– Not present
– Add something to price (even 0)
– Now it is present
– Same for an ALB product
==============================================So to sum it up, you have to apply a price value to the product element even if the price value is just zero. And make sure that product reviews are enabled.
Regards,
IsmaelNovember 26, 2019 at 7:24 pm #1160433Hey @ismael,
Thanks for getting back to me.
So, I have your snipped from an early reply in my child theme functions file, all my products have prices, and I tried enabling reviews to see if that did the trick. Still not quite right.
It does generate some product data (and same if reviews are turned off) but not a complete Product listing for Goole to recognise its actually a product.
November 26, 2019 at 7:28 pm #1160435You can check the product in the field below:
Reviews are still enabled while you inspect it.
- This reply was modified 5 years ago by THP Studio.
November 28, 2019 at 3:38 am #1160856Hi,
Thank you for the update.
The data markup actually exists in the product page, but for some reason the testing tool is not reading it correctly. What happens when the html minification and Yoast schema are disabled?
This is the product data markup:
// https://pastebin.com/LNQ595v1And another data markup generated by Yoast:
// https://pastebin.com/PMHbzaGjWe can’t reproduce the issue on our own installation. The testing tool returns the product’s schema markup correctly.
// https://imgur.com/a/2uwpNhJBest regards,
Ismael -
AuthorPosts
- The topic ‘Product Schema Entirely Missing For Custom Products’ is closed to new replies.