• Resolved refluxcomponents

    (@refluxcomponents)


    Hello, what is the best way to handle when duplicating a product for the vendor to change the slug to the desired value in Vendor Dashboard?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @refluxcomponents,

    Thanks for your query.

    Unfortunately, vendors are unable to change the product URL from their frontend dashboard.

    Here you can do two things.

    You can allow your vendor to access the backend and edit the slug as they want.

    Or as admin, you can edit the duplicate product slug on the behalf of them.

    Best Regards,
    Tanjir

    Thread Starter refluxcomponents

    (@refluxcomponents)

    Actually, here is my solution:

    function reflux_update_slug( $data, $postarr ) {
        if ( ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
            $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'] ), $postarr['ID'], $data['post_status'], $data['post_type'], $data['post_parent'] );
        }
        return $data;
    }
    add_filter( 'wp_insert_post_data', 'reflux_update_slug', 99, 2 );

    Now the users can clone products without getting incorrect slugs/permalinks as a result.

    @refluxcomponents

    Could we chat?

    I think I am having and possibly will have the issues you have mentioned and Dokan support over the past 3 months has not been adequate.

    austin at aleroux dot co
    [email protected]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘When duplicating product, vendors cannot change slug to reflect desired URL’ is closed to new replies.