AMP Notice on WooCommerce Product Search Page
-
Hello,
I’m one of the developers of Astra,
We have come across one issue where it looks like the AMP is generating some errors with the WooCommerce ‘Product Search’ widget.
Below is the notice we are getting:
“Notice: AMP_Theme_Support::get_template_availability was called incorrectly. Working Did not expect there to be more than one matching template. Did you filter amp_supportable_templates to not honor the template hierarchy? Please see Debugging in WordPress for more information. (This message was added in version 1.0.) in C:\xampp\htdocs\breadcrumb\wp-includes\functions.php on line 4231”How to reproduce the error?
1. Install theme Neve/Astra – Add ‘Product Search’ widget to the sidebar.
Screenshot – https://monosnap.com/file/GzVBYpvH9jlXXugFHLOJHU8UoVuU9b2. Search any product from the Search box.
Screenshot – https://monosnap.com/file/SQjDqf3hgDINVfOzsioFIVYEV35Xiq3. On the result page, you should see the notice.
Screenshot – https://monosnap.com/file/xvBD4G6IOcYoFUXu70S76mu6IBXyBbIn your plugin, in file – class-amp-theme-support.php
AT LINE: 552 –
/*
* If there are more than one matching templates, then something is probably not right.
* Template conditions need to be set up properly to prevent this from happening.
*/
if ( count( $matching_templates ) > 1 ) {
_doing_it_wrong( __METHOD__, esc_html__( ‘Did not expect there to be more than one matching template. Did you filter amp_supportable_templates to not honor the template hierarchy?’, ‘amp’ ), ‘1.0’ );
}You guys are checking the number of Templates. In Product Search Page, we get 2 templates – is_search and is_post_type_archive[product].
Would it be possible for you guys to check the is_post_type_archive[product] template in the array and if available pop it from the array of $matching_templates?
OR
Is there any solution for us which we can implement on our end to remove this notice?
Looking forward to your response.
Any help will be much appreciated.
The page I need help with: [log in to see the link]
- The topic ‘AMP Notice on WooCommerce Product Search Page’ is closed to new replies.