[Product Block Editor]: update the conditions to hide the Cross-sells section (#43140)

* update the conditions to hide Cross-sells section

* changelog

* fix eslint issues
This commit is contained in:
Damián Suárez 2023-12-27 19:39:16 -03:00 committed by GitHub
parent 378f610d3a
commit b41ecfe33d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
[Product Block Editor]: update the conditions to hide the Cross-sells section

View File

@ -156,16 +156,11 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
if ( Features::is_enabled( 'product-linked' ) ) {
$this->add_group(
array(
'id' => $this::GROUP_IDS['LINKED_PRODUCTS'],
'order' => 60,
'attributes' => array(
'id' => $this::GROUP_IDS['LINKED_PRODUCTS'],
'order' => 60,
'attributes' => array(
'title' => __( 'Linked products', 'woocommerce' ),
),
'hideConditions' => Features::is_enabled( 'product-linked' ) ? array(
array(
'expression' => 'editedProduct.type === "grouped"',
),
) : null,
)
);
}
@ -1137,9 +1132,9 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
$linked_products_group->add_section(
array(
'id' => 'product-linked-cross-sells-section',
'order' => 20,
'attributes' => array(
'id' => 'product-linked-cross-sells-section',
'order' => 20,
'attributes' => array(
'title' => __( 'Cross-sells', 'woocommerce' ),
'description' => sprintf(
/* translators: %1$s: Learn more about linked products. %2$s: Learn more about linked products.*/
@ -1148,6 +1143,11 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
'</a>'
),
),
'hideConditions' => array(
array(
'expression' => 'editedProduct.type === "external" || editedProduct.type === "grouped"',
),
),
)
);
}