Skip Navigation

[Resolved] [BUG] [CRED Commerce] cred_commerce_form_action hook is not always executed

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by Luo Yang 7 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#462032

The cred_commerce_form_action action is executed only if Go to cart page or Go to checkout page options is selected in the Settings->After visitors submit this form section. If an another option is seleted, for example Go to a page then the hook does not run. The documentation doesn't say anything about it, so it seems it's a bug.

#462243

Dear Lapala,

I can not duplicate same problem, are you using the latest version of CRED commerce plugin?
please check the source codes of CRED commerce plugin, file \cred-commerce\classes\Form_Handler.php, line 131~133:

        if ($this->form->ID == $form_data['id'] && $this->form->isCommerce) {
            // HOOKS API
            do_action('cred_commerce_form_action', $action, $this->form->ID, $post_id, $form_data, $is_ajax);

The action "cred_commerce_form_action" is triggered when it is a CRED form with option " Charge payment with this form" enabled.

And you can debug your own codes here manually.

#462349

This is what I did before posting on forums. onFormSuccessAction() is called only if either Go to cart page or Go to checkout page option is selected.

CRED 1.8.2, CRED Commerce 1.2. I didn't try to update the plugins yet. I'll update this topic after the plugins update. Maybe the bug is already fixed.

#462596

Thanks for the details, I can duplicate same problem, and put it into our todo list, our developers will take care of it.

#466849

Here is the feedback from our developers:
in CRED Legacy onFormSuccessAction callback that contains cred_commerce_form_action
is called only when cred_custom_success_action is triggered
and it is triggered only when we have the redirection on cart/checkout

#466930

So you have just confirmed what I said in the first post. If it's intentional behavior then it should be mentioned in the API documentation.

The documentation says clearly that:

"Action to be executed after CRED Commerce form has been submitted"

According to the documentation, this hook should be triggered when the form is submitted not when the form is submitted AND when we have the redirection on cart/checkout.

SO either there's a bug in the documentation or there's a bug in the code.

#467292

Thanks for the feedback, I forward your comment to our developers.

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.