Automattic\WooCommerce\Admin\Features

NewProductManagementExperience::update_edit_product_link()publicWC 1.0

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

Method of the class: NewProductManagementExperience{}

No Hooks.

Return

String.

Usage

$NewProductManagementExperience = new NewProductManagementExperience();
$NewProductManagementExperience->update_edit_product_link( $link, $post_id );
$link(string) (required)
The edit link.
$post_id(int) (required)
Post ID.

NewProductManagementExperience::update_edit_product_link() code WC 9.0.1

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;
}