WC_Admin_Duplicate_Product::dupe_button()publicWC 1.0

Show the dupe product link in admin.

Метод класса: WC_Admin_Duplicate_Product{}

Хуки из метода

Возвращает

null. Ничего.

Использование

$WC_Admin_Duplicate_Product = new WC_Admin_Duplicate_Product();
$WC_Admin_Duplicate_Product->dupe_button();

Код WC_Admin_Duplicate_Product::dupe_button() WC 7.1.0

<?php
public function dupe_button() {
	global $post;

	if ( ! current_user_can( apply_filters( 'woocommerce_duplicate_product_capability', 'manage_woocommerce' ) ) ) {
		return;
	}

	if ( ! is_object( $post ) ) {
		return;
	}

	if ( 'product' !== $post->post_type ) {
		return;
	}

	$notify_url = wp_nonce_url( admin_url( 'edit.php?post_type=product&action=duplicate_product&post=' . absint( $post->ID ) ), 'woocommerce-duplicate-product_' . $post->ID );
	?>
	<div id="duplicate-action"><a class="submitduplicate duplication" href="<?php echo esc_url( $notify_url ); ?>"><?php esc_html_e( 'Copy to a new draft', 'woocommerce' ); ?></a></div>
	<?php
}