How to use custom permalink for products in wordpress/woocommerce? Is there any ready solution?
I managed to change:
/product/cabinet-with-handle-white-2/
on
/cabinet-with-handle-white-2.html
and ultimately I need to have:
/cabinet-with-white-handle-2,id[PRODUCT ID].html
example: /cabinet-with-handle-white-2,id1453.html
Then when I change the slug name, it will find the product by id
I can't find anything else... anyone have the same?
Need help with shortcode or snippet. I want to change url of products in order detail in cms, now url redirects to edit product but I want do redirect to webshop product, any idea how to change url?
image
I'm afraid you there is no filter to change it ;)
https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-item.php
line 13
I have tried figuring this out for two days with WooCommerce custom slug based.
I have links like mydomain.com/product/product-category/t-shirts/ and I want it to be mydomain.com/product-category/t-shirts/
Yes, want to remove product or store name from the link to get good SEO.
I need to change my product permalinks with a custom base, but when I am trying to set "/%product_cat%/" then automatically it converts to "/product/%product_cat%/" or /%product_cat%/product/.
Finally, I want to set permalinks like this - mydomain.com/fashion(Main Category)/t-shirts(Sub Category)/my-t-shirt-1(Product Name)
Would really appreciate some help!
Thanks
I believe that what you are trying to achieve is not possible with Woocommerce.
If you do want to remove the slug from products or categories you can use a plugin. There are several plugins available, I don't know if I am allowed to post it here, Here what I've used -
1- Install free 'WOO CATEGORY BASE PERMALINK FIXER' plugin from https://masterns-studio.com/code-factory/wordpress-plugin/woo-category-base/
2- Set Product Category Base Permalinks to: shop
3- Set Custom Base Permalinks to: /shop/%product_cat%/
URLs will then look like
http://www.example.com/shop/category/sub-category/product
Seems to work fine for pagination and subcategories.
I'm having some trouble with Wordpress category/subcategory archive URLs.
For example, I want to be able to display this archive: http://faroutmagazine.co.uk/wp/track-of-the-day while keeping its parent category in the URL, making it http://faroutmagazine.co.uk/wp/music/track-of-the-day
Previously, I was just getting a "This is embarrassing..." 404 message when accessing the /music/track-of-the-day URL (even though that's the one that was appearing in the View option under categories in the admin section of WP).
Now the View link in the admin area only shows me the /track-of-the-day URL, and this DOES display the category posts which is great, but I want it to include the parent category in the URL.
Is there anything I can do to the functions.php file or any plugins I can add to make this happen? Please bear in mind that there are multiple subcategory archives on this site, and they should all contain the parent category in the URL.
***UPDATE:
I actually have just set everything up a different way now using Pages and showing category archives on pages as it's taking up too much time. Thanks for your answer though. People telling me to use %category%/%postname% as the permalink structure are incorrect - yes, this works for the POST urls but not for the archive category of the subcategory which is the problem I was actually looking for help with. If anyone can provide an answer, it would be appreciated, but I am using this workaround now as this was taking up way too much time trying to figure out.
This happens because you chose category and subcategory from the right options tick boxes when editing the entry. Choose only the subcategory box in every entry and it will show the nested URL.
To make this happen you need to make some change in permalinks
go to Settings->Permalinks then select custom structure and use this syntax " /%category%/%postname%/ "in the field
Now save the settings and you can see the post url's using its category name in the permalink
Hope it helps :)
You should set hierarchical value to true when you are defining your taxonomy.
'rewrite' => array('slug' => 'mySlug', 'hierarchical' => true),
Then if you have a subcategory the url will be shown like this:
http://example.com/taxonomy/parentCategory/subCategory/
I found this sloution here:
https://wordpress.stackexchange.com/questions/155319/how-to-include-parent-terms-in-hierarchical-taxonomy-urls
Actually hierarchical subcategory archive permalinks are default in wordpress.
If you have a "pretty permalinks" structure selected in settings > permalinks, like /%postname% for example, then category and subcategory archive urls should default to something like:
yourdomain.com/category-base/category/sub-category/sub-sub-category
I had encountered a similar issue with a recent WP project, BUT I was using a plugin called WP No Base Permalink in order to get rid of my category and tag base slugs in my archive permalinks. When I deactivated the plugin, category hierarchy suddenly returned to my archive permalinks (luckily this project was still in development, otherwise, I would have had some major 404 problems).
I have not yet found/tested another plugin for eliminating category/tag base slugs that will also preserve hierarchy in sub/category archive urls, but it turns out that I do not need that functionality for my current project.
Instead I am using the base slugs blog-articles and blog-tags for the standard categories and tags in order to set the blog taxonomies apart from other taxonomies. Then I am using the plugin Types to create a custom post type and custom taxonomies for that post type. The Types plugin has an option in the advanced settings to set hierarchical taxonomy urls to true or false when creating a custom taxonomy.
Finally, I found a plugin called Remove Taxonomy Base Slug that effectively eliminates the default taxonomy term from the base slug of the taxonomy archive urls. And this, thankfully, does not interfere with the hierarchical sub/category urls, OR the base slugs for standard tags and categories.
So now, my blog categories/tags look like this:
yourdomain.com/blog-articles/category/sub-category/
or yourdomain.com/blog-tags/tag/
And my custom post type categories/tags look like this:
yourdomain.com/category/sub-category/ or yourdomain.com/tag/
Phew!
I hope this helps!
Setting Settings->Permalinks->Category base to '%category%' should give you what you want. According to WP doc:
Nested sub-categories appear as nested directories in the URI
See http://codex.wordpress.org/Using_Permalinks.
The Permalinks settings should be like /%category%/%postname%/ ..
If use custom permalinks settings as %postname% only, it will make your url in the form of .../category/subcategory.
You can use WordPress plugin to remove 'category' from url
http://wordpress.org/plugins/wp-no-category-base/
and then follow the instruction given by Maruti
Good day!
In Woocommerce the default URL for listing products is www.site.com/shop/ I would like to change it to www.site.com/products/ as we won't be necessarily selling but would just be showcasing products.
We would like to change /shop/ to /products/. I've tried to change the slug in the Product page but some error do occur.
Please help, Thank you.
Visit "General" -> "Permalinks" section in your admin panel, it will reset permalink structure and error message should disapperar.
Yes it is possible to change the URL from shop to products. you need to go to the pages their you go to the page shop open that page. their you see the option of the edit URL from their you can change the URL of your site from shop to products.
If you simply want to rename shop page to product
Go to Pages> Edit shop page > change permalink to product > Update
You might even rename title to product list or something