ExpertHive Questions + Woocommerce

Is there a way to edit the heading text on the pages “Post Request” and “List Service”?
Also, when there’s a free option for listings, is there a way to skip woocommerce checkout?

Thanks for any help I can get!

1 Like
  1. Please try this PHP snippet
add_filter(
	'hivepress/v1/routes',
	function( $routes ) {
		if(isset($routes['listing_submit_details_page'])){
			$routes['listing_submit_details_page']['title'] = 'Your custom text for List a Service';
		}
		
		if(isset($routes['request_submit_details_page'])){
			$routes['request_submit_details_page']['title'] = 'Your custom text for Post a Request';
		}
		
		return $routes;
	},
	1000
);
  1. Unfortunately, there’s no simple code snippet - this requires advanced customizations and additional testing.
    If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fwd.cx/hLhc73mQCD9R

Thanks! I also want to require users to put in their first name, last name, profile info. I found this snippet you had posted a couple weeks ago but it doesn’t work on my site.

// Make First name and Last name fields required.
add_filter(
	'hivepress/v1/forms/user_update',
	function( $form ) {
		if(current_user_can('edit_posts')){
			$form['fields']['first_name']['required'] = true;
			$form['fields']['last_name']['required'] = true;	
		}

		return $form;
	},
	1000
);

// Make Image field required.
add_filter(
	'hivepress/v1/forms/user_update/errors',
	function( $errors, $form ) {
		$user = $form->get_model();

		if ( $user && ! $user->get_image__id() && current_user_can('edit_posts') ) {
			$errors[] = 'Please upload the profile image.';
		}

		return $errors;
	},
	100,
	2
);

If you mean this code snippet should work for regular users then please try this PHP snippet instead

// Make First name and Last name fields required.
add_filter(
	'hivepress/v1/forms/user_update',
	function( $form ) {
		$form['fields']['first_name']['required'] = true;
		$form['fields']['last_name']['required'] = true;

		return $form;
	},
	1000
);

// Make Image field required.
add_filter(
	'hivepress/v1/forms/user_update/errors',
	function( $errors, $form ) {
		$user = $form->get_model();

		if ( $user && ! $user->get_image__id() ) {
			$errors[] = 'Please upload the profile image.';
		}

		return $errors;
	},
	100,
	2
);

That worked. Can I add “Profile Info” to the requirement please?

Yes, please just add $form['fields']['description']['required'] = true; after $form['fields']['last_name']['required'] = true;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.