Hi,
I have a cred post form where you create a post that is showing in my website via layout.
I want to know if I can create another cred form with Woocommerce product and this product can be join to the previous custom post.
For example:
I have a post created with my cred form. This post can be see it in my website with a layout.
But I want to buy something inside this layout. A product. But this product is created by the same user that created the custom post. And I use the shortcode [add_to_cart id="62729"] where the "id" it has to be the product "id" join with the custom post.
There is a way????
Ok. I follow your indications and almost all is ok. But I have a problem,
I need to edit in front end this 'child' product.
When I do it, it appears all the products but I just want to edit the product created by the user whom creates the parent add.
Now I have an users backend where they can add, delete an view their posts (adds). Now I'm trying to add the product edition in this backend.
I use a view to show the edit product form but I can't find the link parameter to edit just the user product.
There is a way?
If above does not solve the issue, please provide temporary access (WP-Admin and FTP Login info) to your site (preferably staging site), so that I can look into your setup and check the issue.
Your next answer will be private which means only you and I have access to it.
=== Please backup your database and website ===
✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.
✙ Please provide link to the Page link, View Edit Screen link, CRED form edit link.
Thank you for providing login info. But I also requested for page link and other info, please provide the Page link, View Edit Screen link, CRED form edit link.
When I do it, it appears all the products but I just want to edit the product created by the user whom creates the parent add.
==> Please kindly provide page link.
Right now I have no idea where this issue occurs and which CRED form or View is involved in your site so its not possible for me to check without this info.
As I said in the last post my problem not is in the edit form. My problem is in the creation of the new post form.
The page is: hidden link.
First I create an add (hidden link) and then I want to join the product to this add.
I have to use to set parent post cred field _wpcf_belongs_{$parent_slug}_id but I just want to show only the posts created by the user active that moment, not all the posts.
I tried with views as you tell me, but nothing happens. The view doesn't filter child fields. And I returned to insert the cred directly in the page.
There is a way?
I found that topic: https://toolset.com/forums/topic/automatically-set-parent-_wpcf_belongs_parent_slug_id/ but there is not the final solution....
add_action('cred_save_data', 'prefix_product_cred_save_data_action', 10, 2);
function prefix_product_cred_save_data_action( $post_id, $form_data ){
if ($form_data['id']==62893){ //do the following code only if the CRED form ID is 62893, adjust this to your CRED form ID
if (!empty($_POST['event_parent'])){ //if parent is selected
$parent_id = $_POST['event_parent'];
add_post_meta($post_id, '_wpcf_belongs_event-indiv-premium_id', $parent_id, true); //save the ID of the event as parent of the current post
}
}
}