AMP not working for products with 3 selectable attributes

This topic has 37 replies, 2 voices, and was last updated 1 years, 5 months ago ago by Rose Tyler

  • Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 2, 2023 at 14:07

    Hello, PremiumPetware,

    We have conducted a code analysis of how the issue started and how it could be fixed and here are our results of testing:
    1/ All plugins disabled except for needed ones (Elementor, WooCommerce, XStore Core, WPBakery.)
    2/ XStore AMP activated
    3/ Going to a product page from mobile and see FATAL error -> (private area image 01)
    4/ Checking the same product page from the desktop and it is ok -> (private area image 02)
    5/ We found that even if all plugins (most of them) are inactive then you still have an option named “Pantheon Page Cache” with the button to clear cache inside this settings page -> https://prnt.sc/UEtzMRMqv99G
    6/ We decided to clear the cache and then check page from mobile device, and you know what? It does not show any error and works well -> (private area image 03)
    7/ Then we checked this product page from the desktop and here come issues -> (private area image 04, 05)
    8/ By clearing the cache again (inside Pantheon Page Cache panel) and rechecking the desktop product – it is ok again! But the AMP version is broken then.

    Let’s sum up the results of our testing together.

    The first time opening the page after clearing the cache will “keep” that version of page inside the cache independently on the device customer comes. Opening page from another device shows a broken structure (as it loads cache version “overlaping” on files loading for this page).
    Also, it is important to mention that we tried to find this “step” where cache breaks the page. By adding “var_dump” php function in some places ( https://prnt.sc/NB5lgKLtFc1r ) “smartCard-inline”) we noticed the next situation -> (private area image 06). It means that cache makes some caching (sorry for the tautology) of this filter “woocommerce_locate_template” but not for this -> “wc_get_template_part”. Maybe developers of this cache plugin cache template files and as result it creates such issue with AMP version of web-sites.

    Could you please, keep your mind in details provided above and have a conversation with your server to find a way to fully deactivate cache on mobile devices?
    Note: for defining if it is a mobile device we use the default WP function – wp_is_mobile().

    Kind Regards,
    8theme team

    Please contact administrator
    for this information.
    Avatar: PremiumPetware
    PremiumPetware
    Participant
    June 5, 2023 at 11:38

    Hi Rose, thank you very much for continuing to look into this issue, and identifying the cause.

    I have spoken with the platform vendor and they advised 2 things.

    1 – For testing the page caching can be disabled by setting the cache TTL = 0

    I have tried this and AMP is working as expected, I am also able to add the 3 variable products to the cart.

    2 – They referred me to their documentation on caching. I’ll put the link in the private content. It has some technical content and suggested plugins that may help assist resolve this issue.

    I understand that you have spent considerable time looking into this already, but it would be good to know a final solution to this problem, and may benefit others.

    Thanks and regards,

    Blair

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 5, 2023 at 14:20

    Hello, PremiumPetware,

    We have read their documentation. Thanks!
    But we didn’t find any ready solution that we could implement in the XStore AMP plugin.
    The only one useful thing we found in their docs seems “pantheon_session_expiration“ filter that can be added in XStore AMP after initializing but we are not sure it will work only for local customer (who comes from mobile and sees AMP version).

    Also according to the fact you tested after this advice:

    “For testing the page caching can be disabled by setting the cache TTL = 0”
    and XStore AMP version worked normaly then we both (you and us) need to know next cases it could be fixed:
    1/ Could it be set locally (for customer device) when AMP version starts to load?
    or
    2/ Could it be globally set for all customers who come from Mobile devices?
    or
    3/ Could we add globally this filter “pantheon_session_expiration“ in AMP plugin so it will disable cache for that customer when viewing AMP version of web-site.

    It is a question that could be solved only in accommodation with Pantheon devs as the AMP errors come only with their caching system. Could you please, contact them and ask to provide solution that can solve this for you and other customers who use XStore AMP in future?

    Kind Regards,
    8theme team

    Avatar: PremiumPetware
    PremiumPetware
    Participant
    June 7, 2023 at 01:49

    Hi Rose, I have logged this issue on the plugin developers Github page, and will advise when I get a response.

    Thanks and regards,

    Blair

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 8, 2023 at 14:50

    Hello, PremiumPetware,

    You’re welcome!
    Thank you for letting us know.
    Have a nice day!

    Kind Regards,
    8theme team

    Avatar: PremiumPetware
    PremiumPetware
    Participant
    June 16, 2023 at 15:00

    Hi, I haven’t had a response from the developers but when looking for something else in their documentation I found this.

    AMP for WP – Accelerated Mobile Pages
    Last reviewed: Dec 04 2019
    Issue: With the AMP for WP – Accelerated Mobile Pages plugin, enabling the Mobile Redirection feature within AMP for WP sends a session cookie which conflicts with platform-level page caching. See the WordPress support forum for details.

    Solution: Disable the option for Mobile Redirection within the AMP for WP options page. Then handle mobile redirection via PHP within wp-config.php, for example:

    I have posted the example code and link in the private content.

    So I guess the question is, can I apply this in the case of the Xstore amp plugin?

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 16, 2023 at 15:58

    Hello, PremiumPetware,

    Thank you for the details you provided! We really appreciate your work and the time spent for searching such a solution you’ve found!

    Our XStore AMP plugin does not add extra endpoints in URL such as http://yourwebsite.com?amp but leave only The Craziest & Most Affordable Hosting Deal Ever! with all conditions for checking if it is mobile device left from code side. We use wp_is_mobile() wordpress function for detecting if customer comes from mobile device. So it means that your solution is not best for making it fixed in common with XStore AMP plugin. But we can suggest you try next one (a bit modified) code but we cannot guarantee it 100% helps you:

    if (function_exists('wp_is_mobile') && wp_is_mobile()) {
      header('HTTP/1.0 301 Moved Permanently');
    
      // Name transaction "redirect" in New Relic for improved reporting (optional).
      if (extension_loaded('newrelic')) {
        newrelic_name_transaction("redirect");
      }
      exit();
    }

    Kind Regards,
    8theme team

  • 1 2
    Viewing 37 results - 31 through 37 (of 37 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.