admin管理员组文章数量:1303451
I am rendering WooCommerce Cart items in a custom html table wrapper by a form that points to a custom PHP file.
<form class="woocommerce-cart-form" action="/update-cart.php" method="POST">
...
<input type="submit" name="update_cart" value="Update cart">
</form>
When I click on update cart, I get redirected via POST to update-cart.php
where I do some business related actions with the PHP $_REQUEST
.
After doing those actions, I want to call to the WooCommerce original update action, but I am stucked.
This is what I have tried:
// Non of this has worked for me
do_action('woocommerce_update_cart_action_cart_updated'); // 1
WC()->cart->persistent_cart_update(); // 2
do_action('update_cart_action'); // 3
How should I call WooCommerce's update action?
Thank you.
I am rendering WooCommerce Cart items in a custom html table wrapper by a form that points to a custom PHP file.
<form class="woocommerce-cart-form" action="/update-cart.php" method="POST">
...
<input type="submit" name="update_cart" value="Update cart">
</form>
When I click on update cart, I get redirected via POST to update-cart.php
where I do some business related actions with the PHP $_REQUEST
.
After doing those actions, I want to call to the WooCommerce original update action, but I am stucked.
This is what I have tried:
// Non of this has worked for me
do_action('woocommerce_update_cart_action_cart_updated'); // 1
WC()->cart->persistent_cart_update(); // 2
do_action('update_cart_action'); // 3
How should I call WooCommerce's update action?
Thank you.
Share Improve this question asked Feb 11, 2021 at 18:41 rogervilarogervila 1131 silver badge5 bronze badges 5 |1 Answer
Reset to default 1The default form handler is a static method which you can call with
WC_Form_Handler::update_cart_action();
本文标签: theme developmentHow to call WooCommerce update cart function programatically
版权声明:本文标题:theme development - How to call WooCommerce update cart function programatically 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741754159a2396014.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
include_once WC_ABSPATH . 'includes/class-wc-form-handler.php';
– Rup Commented Feb 12, 2021 at 16:52