[Product Block Editor]: Add `Linked product` tab (#43009)

* add linked-products to group IDs

* add Linked Products tab

* tweak hideConditions condition

* changelog

* fix typo in doc comment
This commit is contained in:
Damián Suárez 2023-12-21 16:00:32 -03:00 committed by GitHub
parent 65828db266
commit eac1a460f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 7 deletions

View File

@ -1,4 +1,4 @@
Significance: patch Significance: patch
Type: add Type: add
add `product-linked` feature flag [Product Block Editor]: add `Linked products` tab

View File

@ -16,12 +16,13 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
* The context name used to identify the editor. * The context name used to identify the editor.
*/ */
const GROUP_IDS = array( const GROUP_IDS = array(
'GENERAL' => 'general', 'GENERAL' => 'general',
'ORGANIZATION' => 'organization', 'ORGANIZATION' => 'organization',
'PRICING' => 'pricing', 'PRICING' => 'pricing',
'INVENTORY' => 'inventory', 'INVENTORY' => 'inventory',
'SHIPPING' => 'shipping', 'SHIPPING' => 'shipping',
'VARIATIONS' => 'variations', 'VARIATIONS' => 'variations',
'LINKED_PRODUCTS' => 'linked-products',
); );
/** /**
@ -149,6 +150,24 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
) )
); );
} }
// Linked Products tab.
if ( Features::is_enabled( 'product-linked' ) ) {
$this->add_group(
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,
)
);
}
} }
/** /**