• Resolved RafaelDeJongh

    (@rafaeldejongh)


    While I did already sent an e-mail about this to your support team, I haven’t heard back from you, therefore I’ll be more detailing my search for this problem via this thread.

    So starting off I thought this was a caching issue as I was using WP Rocket, however disabling all my plugins that aren’t required to run the full website being:

    • Elementor
    • Elementor Pro
    • WooCommerce

    The problem still persisted, the problem at hand is that the Mini-Cart doesn’t display the count or the product in the cart once they’re added.

    As I first thought this was a caching issue I first looked into the Ajax fragments but that all looked okay. However the problem was still persistent.

    Changing the amount in the cart page would actually “fix” this problem, but once all products are removed the problem starts over again.

    I am using a child theme from Astra, so I tried to remove all customisations that I added to both the Functions.php and Woocommerce, however this did not fix the problem either.

    Reverting back to the original Astra theme (so without a child theme) it does work directly off the bat. But as I do want to use a child theme as there are quite some changes made to the theme and especially WooCommerce that I don’t just want to enter this in the Astra theme itself.

    I tried various debugging methods but can’t find what this problem actually is, however with the recent 500 crash error from the 1.2.7 update of Astra, I did look at the error logs which showcased also the following:

    [Thu Mar 29 00:18:19.101147 2018] [proxy_fcgi:error] [pid 10353:tid 140204769732352] [client 62.205.118.36:36174] AH01071: Got error 'PHP message: product_type was called incorrectly. Product properties should not be accessed directly. Backtrace: do_action('wp_ajax_elementor_ajax'), WP_Hook->do_action, WP_Hook->apply_filters, Elementor\\Core\\Ajax_Manager->handle_ajax_request, call_user_func, Elementor\\Widgets_Manager->ajax_render_widget, Elementor\\Core\\Base\\Document->render_element, Elementor\\Widget_Base->render_content, ElementorPro\\Modules\\Woocommerce\\Skins\\Skin_Classic->render, wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-product.php'), do_action('woocommerce_after_shop_loop_item'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_loop_add_to_cart, wc_get_template, include('/plugins/woocommerce/templates/loop/add-to-cart.php'), WC_Product_Simple->add_to_cart_text, apply_filters('woocommerce_product_add_to_cart_text'), WP_Hook->apply_filters, custom_woocommerce_product_add_to_cart_text, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong. This message was added in version 3.0.\nPHP message: product_type was called incorrectly. Product properties should not be accessed directly. Backtrace: do_action('wp_ajax_elementor_ajax'), WP_Hook->do_action, WP_Hook->apply_filters, Elementor\\Core\\Ajax_Manager->handle_ajax_request, call_user_func, Elementor\\Widgets_Manager->ajax_render_widget, Elementor\\Core\\Base\\Document->render_element, Elementor\\Widget_Base->render_content, ElementorPro\\Modules\\Woocommerce\\Skins\\Skin_Classic->render, wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-product.php'), do_action('woocommerce_after_shop_loop_item'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_loop_add_to_cart, wc_get_template, include('/plugins/woocommerce/templates/loop/add-to-cart.php'), WC_Product_Simple->add_to_cart_text, apply_filters('woocommerce_product_add_to_cart_text'), WP_Hook->apply_filters, custom_woocommerce_product_add_to_cart_text, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong. This message was added in version 3.0.\nPHP message: product_type was called incorrectly. Product properties should not be accessed directly. Backtrace: do_action('wp_ajax_elementor_ajax'), WP_Hook->do_action, WP_Hook->apply_filters, Elementor\\Core\\Ajax_Manager->handle_ajax_request, call_user_func, Elementor\\Widgets_Manager->ajax_render_widget, Elementor\\Core\\Base\\Document->render_element, Elementor\\Widget_Base->render_content, ElementorPro\\Modules\\Woocommerce\\Skins\\Skin_Classic->render, wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-product.php'), do_action('woocommerce_after_shop_loop_item'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_loop_add_to_cart, wc_get_template, include('/plugins/woocommerce/templates/loop/add-to-cart.php'), WC_Product_Simple->add_to_cart_text, apply_filters('woocommerce_product_add_to_cart_text'), WP_Hook->apply_filters, custom_woocommerce_product_add_to_cart_text, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong. This message was added in version 3.0.\nPHP message: product_type was called incorrectly. Product properties should not be accessed directly. Backtrace: do_action('wp_ajax_elementor_ajax'), WP_Hook->do_action, WP_Hook->apply_filters, Elementor\\Core\\Ajax_Manager->handle_ajax_request, call_user_func, Elementor\\Widgets_Manager->ajax_render_widget, Elementor\\Core\\Base\\Document->render_element, Elementor\\Widget_Base->render_content, ElementorPro\\Modules\\Woocommerce\\Skins\\Skin_Classic->render, wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-product.php'), do_action('woocommerce_after_shop_loop_item'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_loop_add_to_cart, wc_get_template, include('/plugins/woocommerce/templates/loop/add-to-cart.php'), WC_Product_Simple->add_to_cart_text, apply_filters('woocommerce_product_add_to_cart_text'), WP_Hook->apply_filters, custom_woocommerce_product_add_to_cart_text, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong. This message was added in version 3.0.\n', referer: https://themovielot.com.136-144-155-100.lonelyalien.com/wp-admin/post.php?post=10&action=elementor

    While I think it might have something to do with it, I am uncertain to what this actually does change or why it works with the default Astra theme but not with a completely stripped child theme based on Astra.

    Any information would be welcomed! And as I also provided my account details per mail to your support team you’re free to test things out and see if you can reproduce or solve this problem!

    Thanks in advance for further information.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Nikhil Chavan

    (@nikschavan)

    Hello,

    This is definitely cache related. WooCommerce caches output of the cart and refreshes when a cart contents are changed. but on your site, it’s further cached by WP Rocket and its cache is not refreshed after the cart contents are updated.

    I search for the solution from WP Rocket regarding this and it seems they have already documented this – https://docs.wp-rocket.me/article/27-using-wp-rocket-on-your-ecommerce-site

    You can bypass cache based on WooCommerce’s cookies as mentioned in this tutorial. This should fix the problem.

    Thread Starter RafaelDeJongh

    (@rafaeldejongh)

    Update on this:

    This update seems to be also present in the actual main theme as well, I first thought this wasn’t the case but after multiple tests, it comes out that the handling of the single product page add to cart does in fact reproduce the error I am mentioning above.

    You can reproduce this error with the following steps:

    1. Go to your WooCommerce Shop Page
    2. Click on a category
    3. Click on a single product
    4. Click Add to Cart

    After these 4 steps you will see that the number of the mini-cart swiftly changes from a 1 to a 0.

    This is also only the case when you actually add it on a single product, when you’re on the archive/category page and click the “Add To Cart” button, then it does work. However because I changed this in my child theme to just link to the Single Product this has no use for me and makes it nonfunctional.

    Thread Starter RafaelDeJongh

    (@rafaeldejongh)

    @nikschavan

    This is not the case as I mentioned already, this bug is also present without WP Rocket active! And is apparent in the main Astra theme which I first thought wasn’t the case.

    It is not caching, it’s an actual bug and I suggest you to try my steps to reproduce the error. (WP Rocket is disabled and all cache has been removed btw).

    Ps: as mentioned on the link, it should work fine with AJAX and I do think that Astra uses this instead of adding it via PHP, or am I wrong on this?

    Thread Starter RafaelDeJongh

    (@rafaeldejongh)

    So further debugging and investigating, I found that it was related to the secure HTACCESS file made by Bullet Proof Security that was causing this error.

    So I will now be pinpointing it, to what exactly is blocking this AJAX request and will also create a support ticket on BPS to perhaps find the problem together!

    At least it’s one step in the right direction.

    Just quick note that the following were DEFINITELY NOT the problem:

    – Caching (WP Rocket)
    – Error Code posted above
    – Active plugins

    Thread Starter RafaelDeJongh

    (@rafaeldejongh)

    Okay so this actually didn’t had anything to do with the base functionality of BPS, this was actually a “security” header set by default on all our HTACCESS files being the following:

    Header always edit Set-Cookie (.*) “$1;HttpOnly;Secure”

    This one caused the error, I’m still a bit uncertain to why this header edit change actually causes the bug, but after manually removing it, the bug was resolved.

    Therefore it was not Astra nor BPS, it was a self set security header, however I still do wonder to why this is actually happening as that header shouldn’t actually do much other than putting every cookie to secure.

    If anyone has any suggestions to “fix” this Header to still have the possibility to have all my cookies secure then that would be awesome!

    Thanks in advance and sorry for the troubles!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Mini Cart – Number Adding Problem’ is closed to new replies.