WC_Admin_Duplicate_Product
    
            
            in package
            
        
    
    
    
        
            WC_Admin_Duplicate_Product Class.
Table of Contents
- __construct() : mixed
- Constructor.
- dupe_button() : mixed
- Show the dupe product link in admin.
- dupe_link() : array<string|int, mixed>
- Show the "Duplicate" link in admin products list.
- duplicate_product_action() : mixed
- Duplicate a product action.
- product_duplicate() : WC_Product
- Function to create the duplicate of the product.
- generate_unique_slug() : mixed
- Generates a unique slug for a given product. We do this so that we can override the behavior of wp_unique_post_slug(). The normal slug generation will run single select queries on every non-unique slug, resulting in very bad performance.
- get_product_to_duplicate() : object|bool
- Get a product from the database to duplicate.
Methods
__construct()
Constructor.
    public
                __construct() : mixed
        
    
    
        Return values
mixed —dupe_button()
Show the dupe product link in admin.
    public
                dupe_button() : mixed
        
    
    
        Return values
mixed —dupe_link()
Show the "Duplicate" link in admin products list.
    public
                dupe_link(array<string|int, mixed> $actions, WP_Post $post) : array<string|int, mixed>
        
        Parameters
- $actions : array<string|int, mixed>
- 
                    Array of actions. 
- $post : WP_Post
- 
                    Post object. 
Return values
array<string|int, mixed> —duplicate_product_action()
Duplicate a product action.
    public
                duplicate_product_action() : mixed
        
    
    
        Return values
mixed —product_duplicate()
Function to create the duplicate of the product.
    public
                product_duplicate(WC_Product $product) : WC_Product
        
        Parameters
- $product : WC_Product
- 
                    The product to duplicate. 
Return values
WC_Product — The duplicate.generate_unique_slug()
Generates a unique slug for a given product. We do this so that we can override the behavior of wp_unique_post_slug(). The normal slug generation will run single select queries on every non-unique slug, resulting in very bad performance.
    private
                generate_unique_slug(WC_Product $product) : mixed
        
        Parameters
- $product : WC_Product
- 
                    The product to generate a slug for. 
Tags
Return values
mixed —get_product_to_duplicate()
Get a product from the database to duplicate.
    private
                get_product_to_duplicate(mixed $id) : object|bool
        
        Parameters
- $id : mixed
- 
                    The ID of the product to duplicate. 
