WooCommerce Code Reference

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

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>

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
since
3.9.0
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.

Tags
deprecated
3.0.0
see
duplicate_product
Return values
object|bool