[Special Summer Sale] 40% OFF All Magento 2 Themes

Cart

Create product custom permalink in woocommerce

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8948
    David Hoang
    Keymaster

    In Woocommerce Product page I have:
    H1,
    H2 (ACF field) and
    SKU
    Could I create generated automatically a product permalink with these 3 fields?

    With this function I can display the product SKU, but I do not want the (#) in the url, just /SKUnumber:

    function append_sku_string( $link, $post ) {
    
        $post_meta = get_post_meta( $post->ID , '_sku', true );
    
        if ( 'product' == get_post_type( $post ) ) {
            $link = $link . '#' .$post_meta;
    
            return $link;
        }
    }
    add_filter( 'post_type_link', 'append_sku_string', 1, 2 );
    
    #8949
    David Hoang
    Keymaster

    I found the Permalink Manager Pro plugin which is a perfect solution for my issue > https://permalinkmanager.pro/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.