Skip Navigation

[Resolved] cred_commerce_after_payment_completed hook has stopped working

This support ticket is created 6 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.81 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Beda 6 years, 5 months ago.

Assisted by: Beda.

Author
Posts
#907380

I have the following code which has been working for a year:

add_action('cred_commerce_after_payment_completed','my_advert_update',10,1);
function my_advert_update($data)
{
// Extract relevant elements from data
    $form_id = $data['extra_data'][0]['cred_form_id'];
    $post_id = $data['extra_data'][0]['cred_post_id'];
// if form is the Advert Activation Form, set status to 'live' after payment and change end date
if ($form_id==928)
    {
    $ad_listing_status="Live";
    $ad_status_field="wpcf-my-ad-status";
    update_post_meta($post_id, $ad_status_field, $ad_listing_status);   
    $my_end_date = time() + (365 * 24 * 60 * 60);  
    $ad_end_field = "wpcf-my-ad-end-date";
    update_post_meta($post_id, $ad_end_field, $my_end_date);   
    }
}

However, it stopped working a week or so ago (has only just been reported to me). Is this something to do with recent updates?

#907693

This is the document for the function, for reference:
https://toolset.com/documentation/programmer-reference/cred-commerce-api/#cred_commerce_after_payment_completed

The thing is, that function does not exist, as you will see if you run a search for it in the CRED or Toolset Forms Commerce Plugins or any other Toolset Plugin.

This is true since and inclusive CRED Commerce 1.7, where supposedly something related to this exact function was fixed:

1.7
April 23, 2018
Fixed a compatibility issue with WooCommerce 3.2
Fixed an issue about notificationn on Order Payment status Change.

https://toolset.com/download/toolset-cred-commerce/#changelog

I found, that it was refactored, yes, and ported, yes, but the developers made a typo.

The filter now is cred_commerce_after_payment_complete, not anymore as previously cred_commerce_after_payment_completed

For now, this small edit should fix the issue, but of course, I will report this as a BUG and we will fix it.
Thanks a lot for the heads up!

#907838

Thanks Beda.
!!! So much for quality control... Do you think a review of dev controls might be in order?

Please leave this ticket open. When this bug is dealt with, I need to know if they put the d back on!
Thanks,
N

#908809