Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 thread is resolved. Here is a description of the problem and solution.

Problem: When I edit the slug of each product category on default language the result is fine, but if I edit the product category on other language, the product category pages is become 404. I am using some custom code to let the shop page, product base, and product category base have the same value (by default, WooCommerce doesn't work when the same value is used).

Solution: Helping with custom coding is outside of our support scope. We only offer compatibility with the default WooCommerce functionality and making the custom code work with WPML too might require some more coding. This is the reason why I suggest you to have different values for the fields in Settings → Permalinks section. This way, everything will go back to normal.

This topic contains 13 replies, has 2 voices.

Last updated by willemR-6 3 months ago.

Assigned support staff: Radu.

Author Posts
August 15, 2019 at 9:55 am

willemR-6

Hello,

When I edit the slug of each product category on default language the result is fine, but if I edit the product category on other language, the product category pages is become 404.

Got this problem when I try to edit/changes in the site, got 404 result every time I change other language slug or setting.

Hope you can help me this.

Thank you

August 15, 2019 at 1:54 pm #4401319

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+02:00)

Hey Willem,

I checked a couple categories from your website like hidden link or hidden link and everything works fine when I change the language. Can you tell me if there's anything else I should check or maybe I need to make a change in order to see the issue, please? I just want to have a look at it and try to find out why is this happening.

Thanks,
Radu

August 16, 2019 at 5:40 am #4404749

willemR-6

Hello Radu,

Thanks for your response...
Yes, there is need to change in order to see the issue..

First go to "WooCommerce >> WooCommerce Multilingual >> Categories >> Category Translation"
And try to change the slug of one category there, any of category you want and save.
Example: Please see attached image(screenshot1.png). Try to change the slug into "red-vein-nl" and save. And then change again to the original slug "red-vein" and save..

You can check now the categories on website.. it will become 404..

Thanks

August 17, 2019 at 5:25 am #4409413

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+02:00)

Hey Willem,

I just went to Dashboard → Settings → Permalinks, reverted the changes made on the shop fields, and everything works fine about the product categories links. The slugs are different in each language of /red-vein/ and work very well. I think that the issue was that you were using the same text for Product category base and Product permalink → Custom base.

Thanks,
Radu

August 19, 2019 at 6:50 am #4413787

willemR-6

Hello,

Right now I change the product category base into "/buy/" for english and /kopen/ for dutch. Because the site is need to be like that.

English site is work well and no issue URL. But on dutch language is not working right. The category product is 404. And if you click category "Red-vein" it will go to product pages called "Red Vein Sumatra".

Also missing one category on sidebar at kopen page. And the URL is not right, it become "/nl/buy/" and not kopen, but on single product is working fine.

I try to fix everything to work it back as what on old URL before you change, and if I change the slug on "red-vein" it will go back to "red-vein-nl" or "red-vein-nl-2".

I change it here: WooCommerce Multilingual >> Categories >> Category translation. Because "Products >> Categories" is already "red-vein".

Hope you can help me and understand why this happen.

Thanks

August 20, 2019 at 11:48 am #4423303

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+02:00)

Hey Willem,

I just made a couple tests and I could find that WooCommerce (without WPML) is not working when using the same value for shop page, product category base, and product permalink base. This is something from the way that WooCommerce works. As I can see, there are a couple articles (and plugins) that are helping with this (and make things work). Can you tell me if you added any custom code to make the category work, please?

Thanks,
Radu

August 21, 2019 at 7:40 am #4428615

willemR-6

Hello Radu,

I add a code at function.php

//base product category same base shop Page for woocommerce
function devvn_product_category_base_same_shop_base( $flash = false ){
    $terms = get_terms(array(
        'taxonomy' => 'product_cat',
        'post_type' => 'product',
        'hide_empty' => false,
    ));
    if ($terms && !is_wp_error($terms)) {
        $siteurl = esc_url(home_url('/'));
        foreach ($terms as $term) {
            $term_slug = $term->slug;
            $baseterm = str_replace($siteurl, '', get_term_link($term->term_id, 'product_cat'));
            add_rewrite_rule($baseterm . '?$','index.php?product_cat=' . $term_slug,'top');
            add_rewrite_rule($baseterm . 'page/([0-9]{1,})/?$', 'index.php?product_cat=' . $term_slug . '&paged=$matches[1]','top');
            add_rewrite_rule($baseterm . '(?:feed/)?(feed|rdf|rss|rss2|atom)/?$', 'index.php?product_cat=' . $term_slug . '&feed=$matches[1]','top');
        }
    }
    if ($flash == true)
        flush_rewrite_rules(false);
}
add_filter( 'init', 'devvn_product_category_base_same_shop_base');
// taxomony 404
add_action( 'create_term', 'devvn_product_cat_same_shop_edit_success', 10, 2 );
function devvn_product_cat_same_shop_edit_success( $term_id, $taxonomy ) {
    devvn_product_category_base_same_shop_base(true);
}

That code is from hidden link

I use the 2nd code because on the first code is not working even default language, but on the second is working fine, but this what happen when I update the cagegory slug and permalink it become 404 on no reason.

Thanks

August 21, 2019 at 12:25 pm #4431263

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+02:00)

Hey Willem,

Our plugin is made to work with the default behavior of the WooCommerce plugin. The change that you apply by adding that code to your website is a "hack" to change the way the the WooCommerce plugin works. A whole other custom code might be needed in order to make this change work with WPML too.

I'm afraid that I cannot help you with this change since you're asking for compatibility with some custom coding. This kind of job is outside of our support scope. We only offer compatibility with the default WooCommerce functionality, and this is the reason why I suggest you to have different values for the fields in Settings → Permalinks section. This way, everything will go back to normal.

Thanks,
Radu

Thanks,
Radu

August 21, 2019 at 1:05 pm #4431605

willemR-6

Hello Radu,

Thanks for the info/suggestion.

I change into "product-category" for category base and remove the code on function, everything working fine, but some of the category is missing on widget area(sidebar).
I try to "Sync variables products" on hidden link but still not showing on secondary language.

Thanks

August 21, 2019 at 1:57 pm #4432033

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+02:00)

Hey Willem,

Can you tell me if you changed the password for the account you send to me, please? I wanted to have a look at this last issue about the categories but I'm no longer able to access the dashboard (and I get a message that the password is incorrect). Can you check this out, please?

Thanks,
Radu

August 21, 2019 at 3:30 pm #4433207

willemR-6

Hello,

I change the password, you can use it now

Thanks

August 21, 2019 at 3:56 pm #4433853

willemR-6

Hello,

Is the old password work now?
Can you check, please?

Thanks

August 22, 2019 at 7:04 am #4437013

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+02:00)

Hey Willem,

I was able to use the old password. Thank you for checking this out.

Now, regarding the missing category, I have to admit that this is a bit strange. As I can see, the translated category works very well hidden link but, somehow, is not added to the left sidebar.
Can you try to add again the widget to the sidebar? I'm asking for this because I temporarily added the Product Categories widget to the end of the sidebar, and this time it displayed the White Vein category too (hidden link). You can give this a try and tell me how it works.

Thanks,
Radu

August 22, 2019 at 8:54 am #4437651

willemR-6

Hello Radu,

My issue is resolved now.

Thank you!