Possible to link to product detail by sku? (2 posts)

  1. rwkiii
    Posted 3 years ago #

    We have designed a new site to replace an existing one. The previous site used URLs containing the product ID to link to specific products. For example, /shop/GUFC56912.

    I am creating URL Rewrite rules so that the old URLs will still resolve, but the new site (WordPress 3.5.2 w/WooCommerce) uses slugs based on the product title, not the product ID. It will require many more rules in .htaccess if I have to translate product IDs into product titles.

    What I need to know is if there is a way to display a WooCommerce product by its sku so that I can do a permanent redirect to the new product page. If I can load a product page on the new site by its product ID I will only have to create a single rule in .htaccess.

    Is it possible to link to a WooCommerce product by its sku? Any examples? :P


  2. rwkiii
    Posted 3 years ago #

    As a side thought, if it isn't possible to specify a product sku in the URL directly, possibly I can refer to a page template with the sku specified in the querystring, like:


    Then the template could determine the correct slug based on the sku?

    If it isn't possible to specify the sku in the URL directly can anyone give me an idea on how to get the slug by sku using PHP?

    Btw, the sku will be for variations.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic