Skip Navigation

[Resolved] Publish status doesn’t change after payment

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a Commerce Form that creates a post and should set the post status as "published" once completed. After the Stripe API processes payment, the post does not change status.

Solution: This is the expected behavior, because Commerce Forms changes post status when the Order is "complete". If your payment method does not change the Order status, then no post status update will be triggered by Commerce Forms. There are custom code solutions for this and 3rd-party plugins that can automatically change the Order status for you.

Relevant Documentation:
https://toolset.com/documentation/user-guides/charging-payments-with-cred-to-register-users/#marking-the-order-as-complete

This support ticket is created 6 years, 6 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by Armando 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#914119
Edit_Post_Form_‹_CathLab_com_—_WordPress.png
Edit_Post_Form_‹_CathLab_com_—_WordPress 2.png

I am trying to:
Set the publish status after payment of submission

I expected to see:
Published Status

Instead, I got:
Draft Status

Hi, after processing payment (Stripe TEST API Enabled), the status of the post remains as draft after payment has processed.

If I were to change the status in the top area to publish, it gets published after submission and before payment gets processed, therefor, posting a 'free' post.

My settings are in the screen shots attached.

The same form we were working on the previous support ticket. Thank you so much Minesh.

#914456

Hi, there is currently a known issue with the Forms (CRED) Commerce API not firing specific events when the Order is completed. Please read the erratum post here and apply the patch as described: https://toolset.com/errata/api-action-after-the-payment-gets-completed-is-not-fired/

Then retest the payment complete process. If the status is still not updated as expected, please temporarily enable an offline payment method like "Check payment" or "Cash on delivery" and complete an Order manually in wp-admin. Is the related Forms Commerce post status updated correctly when using a different payment method?

Let me know the results and we can go from there.

#914488

Hi Cristian, I updated the file, cleared cache, etc etc. The problem still persists. I tried a offline method as suggested (check) and that does seem to work.

It looks like it doesn't work with Stripe in test mode.

Thank you.

#914848

Okay so it sounds like the notification is triggered when you complete an Order manually. Is the Order automatically marked as "Complete" after payment is processed by Stripe?

If your answer is No: This is the expected behavior, because Form notifications are triggered when the Order is marked "Complete". Check the documentation here for some more information about this: https://toolset.com/documentation/user-guides/charging-payments-with-cred-to-register-users/#marking-the-order-as-complete

If your answer is Yes: Let me know and I can take a closer look. I will need some time to research using Stripe's Test API.

#915028

Thank you for the reply. Yes, that was the issue. I checked out the plugin but, I dont want to install another plugin for a simple solution and it seems outdated. As a solution, as per Woocommerce Documentation, I used:

/**
 * Auto Complete all WooCommerce orders.
 */
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) { 
    if ( ! $order_id ) {
        return;
    }

    $order = wc_get_order( $order_id );
    $order->update_status( 'completed' );
}

Thanks again.