Skip Navigation

[Resolved] Register > Woocommece checkout Fatal error

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.

This topic contains 4 replies, has 2 voices.

Last updated by TomW5440 5 months, 1 week ago.

Assigned support staff: Waqar.


Is there any documentation that you are following?

Tell us what you are trying to do?
Set register form to go to checkout on submit. I followed the documentation but get a fatal error message when submitting new user form.

Fatal error: Uncaught InvalidArgumentException: All provided arguments for a related element must be either an ID or a WP_Post object. in /home/alwaysre/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/inc/autoloaded/interop/commands/RelatedPosts.php:246 Stack trace: #0 /home/alwaysre/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/inc/autoloaded/interop/commands/RelatedPosts.php(177): OTGS\Toolset\Common\Interop\Commands\RelatedPosts->set_query_by_elements(Array, 'child') #1 /home/alwaysre/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/inc/public_api/m2m.php(159): OTGS\Toolset\Common\Interop\Commands\RelatedPosts->__construct('draft_0', 'member-comment', Array) #2 /home/alwaysre/public_html/wp-content/toolset-customizations/redirect_hook.php(12): toolset_get_related_post('draft_0', 'member-comment') #3 /home/alwaysre/public_html/wp-includes/class-wp-hook.php(307): custom_redirect('hidden link...', 'draft_0', Array) #4 /home/alwaysre/p in /home/alwaysre/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/inc/autoloaded/interop/commands/RelatedPosts.php on line 246



Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)


Thank you for contacting us and I'd be happy to assist.

From the error message, it seems that the custom code added in the Toolset's custom code snippet "redirect_hook" is responsible for this.

Can you please share temporary admin login details, along with the link to this registration page? I'll be able to see how the form and the custom code snippet are configured and suggest the next steps, accordingly.

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.



I'm not sure if this is related but I've got another error on the checkout page

Notice: Trying to access array offset on value of type null in /home/alwaysre/public_html/wp-content/plugins/cred-commerce/classes/CRED_Commerce.php on line 886

The first column is only 8% wide. Screen print attached.



Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing the admin access.

I noticed that in the custom code snippet named "redirect_hook", the code to get the related parent "Member" post was added in a way that it executes for all the forms and not just for the intended form "Edit comment" (ID: 434).
( screenshot: hidden link )

As a result, when other forms are submitted, it results in an error. To make code execute only for that particular form, please update it to:

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
	if ($form_data['id']==434) {
		$parent_id = toolset_get_related_post( $post_id, 'member-comment' );
		$parent_url = get_permalink($parent_id);
		return $parent_url;

	return $url;

This should fix the errors.


My issue is resolved now. Thank you!