WP Manifestindependent plugin directory
manifest / ecommerce / woocommerce-permalink-structure

WooCommerce Permalink Structure

Allows WooCommerce products to have the same permalink path prefix as product categories and the shop base page.

★ 1stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/netzstrategen/woocommerce-permalink-structure/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WC requires at least: 6.0 WC tested up to: 10.9.1 Stable tag: 1.2.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html

Allow WooCommerce products to share the same URL path prefix as product categories and the shop base page.

Description

Allows WooCommerce products to have the same permalink path prefix as product categories and the shop base page; i.e., '/shop/category/subcategory/product-name'. Adjusts internal WordPress rewrite rule structure; not necessarily compatible with all plugins and shop configurations.

Installation

  1. Add the plugin as a Git submodule at wp-content/plugins/woocommerce-permalink-structure:

     git submodule add --name woocommerce-permalink-structure -- git@github.com:netzstrategen/woocommerce-permalink-structure.git wp-content/plugins/woocommerce-permalink-structure

    Alternatively, upload the extracted woocommerce-permalink-structure folder to /wp-content/plugins/ as usual.

  2. Activate the plugin through the 'Plugins' menu in WordPress, or with WP-CLI:

     wp plugin activate woocommerce-permalink-structure
  3. Under Settings → Permalinks (/wp-admin/options-permalink.php), configure both of the following to share the same prefix:

    • Product category base: e.g. shop
    • Product permalink base: select "Shop base with category" (/shop/%product_cat%/)

    Note: the "Shop base with category" radio derives its prefix from the Shop page's own slug, not from the "Product category base" field above. The two settings only end up aligned because the Shop page's slug and the configured category base are both shop in this example; if either one changes, review the other.

  4. Click Save Changes on that screen (or run wp rewrite flush). This is required even if the values above were already correct: WordPress does not regenerate rewrite rules just because a plugin was activated, so the plugin's own rewrite rule is missing until the rules are flushed at least once after activation.

Requirements

  • PHP 7.4 or later.
  • WooCommerce 6.0 or later. The plugin relies solely on long-stable WooCommerce APIs (product_cat_rewrite_rules, wc_get_page_id(), the woocommerce_permalinks option) that have not changed in years, so older releases are expected to work but have not been explicitly tested.

Configuration

By default, the WooCommerce "Shop" page renders the regular product archive instead of its own page content whenever the Shop page's slug is used as the product category base (see "Installation" above). This happens at the URL-rewriting level, before WordPress resolves a template — assigning a different template to the Shop page itself has no effect on /shop, because the request is never routed as a page request in the first place.

To instead render the Shop page's own content (built with blocks like any other page) on /shop, and skip the automatic product archive entirely, define the following constant in wp-config.php or a custom plugin:

const WOOCOMMERCE_PERMALINK_STRUCTURE_SHOP_PAGE_CONTENT_ONLY = TRUE;

This setting is unrelated to block themes / full-site editing and is not made obsolete by them: editing the "Product Catalog" (archive-product.html) template in the Site Editor changes what every product category archive looks like, but it cannot make /shop behave like a normal page, since without this constant WooCommerce never lets the request reach the page template hierarchy for that URL at all. Use this constant only if /shop itself needs to show custom one-off content instead of the product catalog.