Skip Navigation

[Resolved] Cred for Woocomerce (similar to field factory)

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
- 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 5 replies, has 2 voices.

Last updated by Luo Yang 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#567715

Hi,

Thank your great plugins and continued support. I was wondering if you are considering or would look into adding the ability to create cred forms that attach to woocomerce products, much like the WC Field Factory Plugin does (https://wordpress.org/plugins/wc-fields-factory/). Seems like you have most of the work set. I am in the process of building out a site, but you can see the feature here: (hidden link) I like how it is part of the purchase, rather than a form stuck at the bottom (see at the description area).

Thanks,
Brian

#568346

Dear Brian,

Sorry for the delay answer, I was on a trip, for your question:
adding the ability to create cred forms that attach to woocomerce products, much like the WC Field Factory Plugin does (https://wordpress.org/plugins/wc-fields-factory/).

There isn't such a built-in feature within CRED form, but as a workaround, you can try this:
1) setup a new post type "Description" as child post type of "Product"
https://toolset.com/documentation/user-guides/creating-post-type-relationships/
and you can display

2) setup a CRED form for creating child "Description" post, in this CRED form add CRED commerce settings, use action hook "cred_commerce_add_product_to_cart" to dynamically alter the product associated with a CRED Commerce form as it's parent "product", for example:

add_filter('cred_commerce_add_product_to_cart','change_product_to_cart',10,3);
function change_product_to_cart($product_id, $form_id, $post_id) {
    if($form_id == 123){
	$pid = get_post_meta($post_id, '_wpcf_belongs_product_id',true); // get the parent product ID
	if($pid){
		$product_id = $pid;
	}
    }
    return $product_id;
}

Please replace 123 with the CRED form ID of step 2
More help
https://toolset.com/toolset-api/cred_commerce_add_product_to_cart/

3) in a single product post, you can also display related child "Description" posts by creating a view:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

#568494

Thank you for your answer, you all are always on top of it. I am looking into this now and trying to wrap my head around it.

#568580

OK, please let me know if you need more assistance for it, thanks

#569361

Hi Luo,

Is there away to put the cred fields into the product page (without the submit button) ? I would like to save a step. Rather than, having too a guest fill out the cred form, than go to the product page to pick there category (variable product) than go to cart page, to finally finish the checkout page. Would also love it it they can do form entry for each category selected.

Thanks,

#569394

The submit button is required by default, but you can try with some custom JS codes to submit the form without submit button, when user click a category link, trigger a function:
hidden link
in this function, submit the CRED form
hidden link

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