Closed ghost closed 3 years ago
Hey @grenders
Do you have the most current stable release of the package installed, which is version 0.5.3.1? The wc_action
function was introduced in version 0.5.3: https://github.com/mindkomm/timber-integration-woocommerce/releases/tag/0.5.3.
Hey @grenders
Do you have the most current stable release of the package installed, which is version 0.5.3.1? The
wc_action
function was introduced in version 0.5.3: https://github.com/mindkomm/timber-integration-woocommerce/releases/tag/0.5.3.
Yes, the last one. This function works correctly when I display the woocommerce cart. However, when I try to display the same Ajax cart with a request, I get this error. I can't figure out what's wrong. Why is this happening.
There is an assumption that the Ajax request is isolated. However, without calling this function, the twig returns a valid one.
No idea why this is happening?
I found the problem. Finally. Your template in the WooCommerce class uses an admin check. However, very often when writing topics, admin ajax is used because it is convenient. Is this verification really necessary?
Sorry for my persistence. Will this check be fixed? Or should I still change the approach to the formation of ajax request?
I found the problem. Finally. Your template in the WooCommerce class uses an admin check.
Thanks for taking the time to find what’s causing the issue!
However, very often when writing topics, admin ajax is used because it is convenient. Is this verification really necessary?
I’m not against using admin ajax at all. If I remember correctly, the reason I added the is_admin()
bailout is because I wanted to prevent any unwanted side effects and not call functionality on every admin page load that is not necessary. But I have to admit I didn’t think of the admin ajax use case. And when I look at the code that is called, there shouldn’t be any side effects in the backend, because I don’t change any queries or the like.
Will this check be fixed?
Yes, I’ll definitely fix this. Probably next week, together with a proper release of the newest release candidate.
Can I install the release candidate version through the composer?
Can I install the release candidate version through the composer?
Yes, you could install the pre-release by updating the version constraint in your composer.json file or with the following command:
composer require mindkomm/timber-integration-woocommerce:0.6.0-rc.1
But that shouldn’t be necessary anymore.
I fixed this issue in https://github.com/mindkomm/timber-integration-woocommerce/commit/9a7f37a070d7fcef0418f69b6a54dc25d927db2b and released it with the 0.6.0 release. You can update the integration with
composer update mindkomm/timber-integration-woocommerce
where twig is this
{% do wc_action('woocommerce_before_cart_totals') %}
.I get an error "CRITICAL Uncaught Twig\Error\SyntaxError: Unknown "wc_action" function. Did you mean "action"?". What's wrong?