Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Zhehao Tang

I cannot edit my product in Woocommerce

In Woocommerce, added a type ‘Product – Details’ column. Then the page ‘Orders’ shows me the product details, but if I click the product title, it will open a edit page to the Product Variation.

4 years, 2 months ago
Zhehao Tang

It will have the same error in type ‘Product’, if I choose ‘edit’ in ‘Link To’ option.

4 years, 2 months ago
Stefan van den Dungen Gronovius
Developer

Thanks for your feedback.
Yes, it would indeed be better to go to the actual product page instead of the variation edit page which does not exist. I’ll put it on the backlog.

In the meantime, you can use the following snippet to correct it on your environment.

add_filter( 'get_edit_post_link', function ( $link, $id, $context ) {
	if ( function_exists( 'wc_get_product' ) ) {
		$product = wc_get_product( $id );
		if ( $product instanceof WC_Product_Variation ) {
			return get_edit_post_link( $product->get_parent_id() );
		}
	}

	return $link;
}, 10, 3 );
4 years, 2 months ago
Zhehao Tang

Thanks for your help!

4 years, 2 months ago

You must be logged in to reply to this topic.