WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Possible to link to product detail by sku? (2 posts)

  1. rwkiii
    Member
    Posted 9 months 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

    http://wordpress.org/extend/plugins/woocommerce/

  2. rwkiii
    Member
    Posted 9 months 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:

    /product-by-sku.php/?sku=ABC1234

    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.

    Thanks.

Reply

You must log in to post.

About this Plugin

About this Topic