Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 15 replies, has 3 voices.

Last updated by Bigul 4 years ago.

Assigned support staff: Bigul.

Author Posts
March 26, 2017 at 3:17 pm #1239705

Alan

Hi

I wan't all posted products in all languages to be on only one shop url.

This means, that when I post a product any language, no matter if in English, German and French, all these producst should be seen in one shop page.

I translated the woocommerce shop page url into different languages.
When I post a product in English, and then switch the language to German, the shop page is empty. The posted product is only visible in the English shop url.

- hidden link (The product is visible)
- hidden link (The product is not visible)
- hidden link (The product is not visible)

Can this be done, without having to dublicate each posted product to the other languages?
Because this loads a lot of unnecessary images and content to my server harddisk.

In my setup I only want the categories to be translated, but not the products by itself.

Thanks - Alan

March 28, 2017 at 1:10 am #1240793

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello @alan,

Thank you for contacting WPML support. I'd be happy to help you on this.

Yes, you can achieve this, basically, the most used way is to duplicate the product itself on all languages.
+ https://wpml.org/forums/topic/display-original-language-woocommerce-products-in-all-languages/

If you don't want to duplicate the product itself and show it in all languages, you should create some custom functionality, which is out of scope at the moment.

At this point, I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/

You will get the custom assistance you need to get on with your project. Before doing so please have a look also here: http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

Let me know if this helps.

Thanks

March 29, 2017 at 7:02 pm #1242714

Alan

Hi

Ok, so I found a link just for dublication of woocommerce products for all languages, that matches my needs, but it dosen't work for me when I post this code into my functions.php:

https://wpml.org/forums/topic/cron/#post-876903

function my_duplicate_on_publish( $post_id ) {
global $post;
// don't save for autosave
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return $post_id;
}
// dont save for revisions
if ( isset( $post->post_type ) && $post->post_type == 'revision' ) {
return $post_id;
}

// we need this to avoid recursion see add_action at the end
remove_action( 'save_post', 'my_duplicate_on_publish' );

// make duplicates if the post being saved
// #1. itself is not a duplicate of another or
// #2. does not already have translations

$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 );
}
}
// must hook again - see remove_action further up
add_action( 'save_post', 'my_duplicate_on_publish' );

This code also dosen't work:

https://wpml.org/wpml-hook/wpml_admin_make_post_duplicates/

Can you please tell my why?

Thanks - Alan

March 30, 2017 at 1:02 am #1242838

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

Please use the code provided here to duplicate the products and let me know if this helps.
https://wpml.org/forums/topic/wp-job-manager-auto-duplicate-job-posts/

I look forward to your reply.

Thanks

March 30, 2017 at 7:30 am #1242977

Alan

Hi

Will this code only duplicating Woocommerce Products?

I don't what to duplicate blog posts or any other content, only Woocommerce Products.

Thanks Alan

March 30, 2017 at 7:33 am #1242980

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

No it will duplicate whole posts/pages, to only duplicate the product please use the following code:

add_action( 'wp_insert_post', 'my_duplicate_on_publishh' );
function my_duplicate_on_publishh( $post_id ) {
       
    $post = get_post( $post_id ); 
        
    // don't save for autosave
    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
        return $post_id;
    }
    // dont save for revisions
    if ( isset( $post->post_type ) && $post->post_type == 'revision' ) {
        return $post_id;
    }
    //insert your custom post type here
    if($post->post_type == 'product'):
     
    // we need this to avoid recursion see add_action at the end
    remove_action( 'wp_insert_post', 'my_duplicate_on_publishh' );
     
        // make duplicates if the post being saved
        // #1. itself is not a duplicate of another or
        // #2. does not already have translations
     
        $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 );
        }
     
    // must hook again - see remove_action further up
    add_action( 'wp_insert_post', 'my_duplicate_on_publishh' );
    endif;
}
March 30, 2017 at 3:48 pm #1243593

Alan

Hi

I get a blank page, when adding this code to functions.php.

Please advise.

March 31, 2017 at 2:40 am #1243899

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

This seems unusual, to further debug this issue, I need to request temporary access (wp-admin and FTP) to your site in order to be of better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. hidden link

This info is private and available to you and supporters only. Read more about this: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Note that:
+ Backup (both files and database) your site before giving us your credentials
+ It would be better if you give me the test site rather than the live site.

We'd like to request the permission to disable, enable and install themes and plugins for this site. Please accept this?

I look forward to your reply.

Thanks

April 3, 2017 at 5:47 pm #1246137

Alan

Hi

It would be great, if you could post a product in English, and then verify, how it is copied to the other languages, and make this work.

Thanks - Alan

April 4, 2017 at 2:03 pm #1246938

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi ,

I am Bigul from WPML support team. Shekhar is on vacation. So I am take caring this ticket. Hope it will be okay for you.

I am unable to access the Dashboard. It is showing me the following warning. Please check the attached image for more details.

This has been disabled

I would like to access your Dashboard for checking more about the Page not found issue of Products page in secondary language -- hidden link

I have a request. As per support policies and help you better please create a new ticket for the *WC Vendors* issue. This will help other users with similar problems to find solutions when searching the forum. Also, we can avoid discussing multiple problems in a single thread.

--
With Regards

Bigul

2017-04-04_1926.png
April 5, 2017 at 1:10 pm #1247847

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Thank you for the login details. But one request, don't share the private details in open threads. Becuase it is a public forum and may it will harm your website. So I have hidden your last comment.

I made a duplicator copy of your site and will debug it as soon as possible. Please wait.

--
With Regards

Bigul

April 5, 2017 at 5:44 pm #1248153

Alan

Hi Bigul

I posted a product yesterday in the English language, and the product, didn't copy correctly to the other languages - I get a 404 page.

Moreover I see the product posted 3 times in my WC Vendors Pro dashboard.
This wouldn't make sence for my vendors. Whenever they post one product, it shows up 3 times in their dashboard (because their are 3 languages in total.

Just for your information.

Thanks that you are looing in to this.

April 6, 2017 at 12:05 pm #1248812

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Thank you for the updates. I have one doubt, does it happen when you have created Product as a Vendor user?

--
With Regards

Bigul

April 7, 2017 at 11:19 am #1249743

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Thank you for the details. I have made a new duplicator package and also hidden your previous comment. I am debugging the issue locally now and get back to you soon. Please wait.

--
With Regards

Bigul

April 10, 2017 at 1:34 pm #1251215

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Sorry for the delay because of the weekend. Please open a new ticket for the Products listing thrice on *WC Vendors Pro dashboard* and assign it to me. It looks like a compatibility issue between WPML and WC Vendors. As per our support policies, we can only handle a single issue in a ticket and also we can avoid discussing multiple issues in a single ticket.

I am still working on the Page Not found issue while visiting the Products in the frontend. Please wait.

--
With Regards

Bigul

2017-04-10_1850.png