• Resolved masterross

    (@masterross)


    Hi,

    Thank you for your product.
    Please consider adding duplicate link in Admin bar below “Edit product” at front end of the product.
    Thank you!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ActionPHP

    (@actionphp)

    Hello,

    You can now duplicate from the admin bar on the front end.

    All the best,
    Jean Paul
    WPGem.com

    Thread Starter masterross

    (@masterross)

    Thanks mate!

    Unfortunately, it didn’t work for me.
    So based on your function and my themes (Flatsome) admin edit bar function I re-wrote it:

    /**
     * Add ?Duplicate this product in
     * admin toolbar
     */
    
    function ross_admin_bar_link() {
    
     if(is_product()){
    
            global $wp_admin_bar;
            global $post;
    
            if ( ! current_user_can( 'edit_post', $post->ID ) ) {
                    return;
            }
    
            $duplicate_url = wp_nonce_url( admin_url( 'edit.php?post_type=product&action=duplicate_product&post=' . $post->ID ), 'woocommerce-duplicate-product_' . $post->ID );
    
                    $wp_admin_bar->add_menu( array(
                            'parent' => 'edit',
                            'id'     => 'wedp_admin_bar_button',
                            'title'  => 'Duplicate this product',
                            'href'   => $duplicate_url,
                                                                    'meta' => [
    
                                                            'target' => '_blank',
    
                                                            ]
                    ) );
    
    }
    
    }
    
    add_action( 'wp_before_admin_bar_render', 'ross_admin_bar_link', 30);
    

    Not sure is it correct syntaxis but works

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Duplicate link in admin bar’ is closed to new replies.