Closed anarepa closed 3 years ago
I think there is a bug in this code. The parent Id for variable product is 0. The condition should remove 'variable'. Only a variation has a parentID. Correct me if I am wrong. Thanks!
public function get_product_slug( $object ) { $product_type = $object->get_type(); if ( 'variable' === $product_type || 'variation' === $product_type ) { $product = wc_get_product( $object->get_parent_id() ); $product_slug = $product->get_slug(); } else { $product_slug = $object->get_slug(); } return $product_slug; }
You are correct @anarepa Feel free to send a PR and I will credit you as a contributor.
I think there is a bug in this code.
The parent Id for variable product is 0. The condition should remove 'variable'. Only a variation has a parentID. Correct me if I am wrong. Thanks!