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();
include_once WC_ABSPATH . 'includes/class-wc-form-handler.php';
– Rup Commented Feb 12, 2021 at 16:52