WooCommerce Code Reference

Search results

WC_Admin_Duplicate_Product

WC_Admin_Duplicate_Product Class.

Table of Contents

__construct() Constructor. mixed
dupe_link() Show the "Duplicate" link in admin products list. array
dupe_button() Show the dupe product link in admin. mixed
duplicate_product_action() Duplicate a product action. mixed
product_duplicate() Function to create the duplicate of the product. WC_Product
get_product_to_duplicate() Get a product from the database to duplicate. object|bool
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. mixed

Methods

dupe_link()

Show the "Duplicate" link in admin products list.

public dupe_link( $actions : array , $post : WP_Post ) : array
Parameters
$actions : array

Array of actions.

$post : WP_Post

Post object.

Return values
array

get_product_to_duplicate()

Get a product from the database to duplicate.

private get_product_to_duplicate( $id : mixed ) : object|bool
Parameters
$id : mixed

The ID of the product to duplicate.

Tags
deprecated
see
Return values
object|bool

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( $product : WC_Product ) : mixed
Parameters
$product : WC_Product

The product to generate a slug for.

Tags
since
Return values
mixed
Back to the top