Automattic\WooCommerce\Admin\Features\ProductBlockEditor

Init::update_edit_product_link()publicWC 1.0

Update the edit product links when the new experience is enabled.

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

Хуков нет.

Возвращает

Строку.

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

$Init = new Init();
$Init->update_edit_product_link( $link, $post_id );
$link(строка) (обязательный)
The edit link.
$post_id(int) (обязательный)
Post ID.

Код Init::update_edit_product_link() WC 8.7.0

public function update_edit_product_link( $link, $post_id ) {
	$product = wc_get_product( $post_id );

	if ( ! $product ) {
		return $link;
	}

	if ( $product->get_type() === 'simple' ) {
		return admin_url( 'admin.php?page=wc-admin&path=/product/' . $product->get_id() );
	}

	return $link;
}