Automattic\WooCommerce\Admin\Features\ProductBlockEditor
Init::update_edit_product_link
Update the edit product links when the new experience is enabled.
Method of the class: Init{}
No Hooks.
Returns
String.
Usage
$Init = new Init(); $Init->update_edit_product_link( $link, $post_id );
- $link(string) (required)
- The edit link.
- $post_id(int) (required)
- Post ID.
Init::update_edit_product_link() Init::update edit product link code WC 10.6.2
public function update_edit_product_link( $link, $post_id ) {
$product = wc_get_product( $post_id );
if ( ! $product ) {
return $link;
}
if ( $product->get_type() === ProductType::SIMPLE ) {
return admin_url( 'admin.php?page=wc-admin&path=/product/' . $product->get_id() );
}
return $link;
}