First, thanks to the support team. You already helped me a lot through the Knowledge Base. I’m on Woocommerce 2.6.14 and Wc vendor 1.3.9 (not latest version I know but I doubt my problem comes from this from reading what’s new in 1.4.0.)
I’m not asking you to solve my problem or do the work for me but more to guide me in the right path to follow.
Let me explain.
The problem start with WPML that require a duplicate of the post to show the product on the user selected language.
I had to duplicate all posts on publish. I used some code I found here that goes like:
function my_duplicate_on_publish( $post_id ) {
global $post;
if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) {
return $post_id;
}
if ( isset( $post->post_type ) && $post->post_type == ‘revision’ ) {
return $post_id;
}
remove_action( ‘save_post’, ‘my_duplicate_on_publish’ );
$is_translated = apply_filters( ‘wpml_element_has_translations’, ”, $post_id, $post->post_type );
if ( !$is_translated ) {
do_action( ‘wpml_admin_make_post_duplicates’, $post_id );
}
}
add_action( ‘save_post’, ‘my_duplicate_on_publish’ );
Fine! It helped. Once the admin acknowledge the post and publish it the translated version is created and I can see my product in my 2 different languages. Everything is great!
But this caused some other problems. Some I solved and some I’d need guidance to overcome.
My biggest worry is that I need some user to have to right to publish themselves without verification.
Hence, I trusted them in Store general options.
Problem 1.
The only problem is that these users do not register in the previous function when they save the post at first. No duplicate is made until the user goes and edit the product (then a duplicate is created but has no photo this time).
So!
What would be my best option?
1. Try and find what is missing in the function to duplicate on publish by a trusted user
2. Add a publish button so they must publish it themselves after creation?
Problem 2.
Products duplicate are listed twice in the Dashboard. I think I can solve this problem myself but if you have a hint on the best place to edit to remove products that are translations it would be appreciated.
Thanks a lot,
Mathieu Wilson