Merge pull request #16427 from nyordanov/variation-permalink-infinite-loop
Prevent infinite recursion in WC_Post_Data::variation_post_link()
This commit is contained in:
commit
f62d505797
|
@ -66,7 +66,7 @@ class WC_Post_Data {
|
|||
* @return string
|
||||
*/
|
||||
public static function variation_post_link( $permalink, $post ) {
|
||||
if ( isset( $post->ID, $post->post_type ) && 'product_variation' === $post->post_type && ( $variation = wc_get_product( $post->ID ) ) ) {
|
||||
if ( isset( $post->ID, $post->post_type ) && 'product_variation' === $post->post_type && ( $variation = wc_get_product( $post->ID ) ) && $variation->get_parent_id() ) {
|
||||
return $variation->get_permalink();
|
||||
}
|
||||
return $permalink;
|
||||
|
|
Loading…
Reference in New Issue