Show variations in upsells when parent is not published (#30042)
* Show variations in upsells when parent is not published I was struggling to get the upsell section to show for our eCommerce site. After some digging I found that line 1525 stopped variations from showing in the upsell section if the parent product was set to privately published. This makes testing products and upsells hard, and it's inconsistent behaviour when simple products that are privately published do show up. The proposed change will make variations show up as long as the current user can edit the parent product. This is consistent with the behaviour for simple products. * Add changelog --------- Co-authored-by: Jorge Torres <jorge.torres@automattic.com>
This commit is contained in:
parent
94e4ffd611
commit
acdb2df13a
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Display variation upsells from private variable products to users with required permissions.
|
|
@ -1603,7 +1603,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
|||
if ( $this->get_parent_id() ) {
|
||||
$parent_product = wc_get_product( $this->get_parent_id() );
|
||||
|
||||
if ( $parent_product && 'publish' !== $parent_product->get_status() ) {
|
||||
if ( $parent_product && 'publish' !== $parent_product->get_status() && ! current_user_can( 'edit_post', $parent_product->get_id() ) ) {
|
||||
$visible = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue