Variations tab should be moved to the second tab, after General (#43998)

* Move variations tab to position 2 so it will appear right next to the general tab

* Add changelog file
This commit is contained in:
Maikel Perez 2024-01-23 11:45:59 -03:00 committed by GitHub
parent 30dfa013f9
commit 7ec8f7932e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 29 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: enhancement
Move variations tab to position 2 so it will appear right next to the general tab

View File

@ -73,10 +73,37 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
),
)
);
// Variations tab.
if ( Features::is_enabled( 'product-variation-management' ) ) {
$variations_hide_conditions = array();
if ( Features::is_enabled( 'product-grouped' ) ) {
$variations_hide_conditions[] = array(
'expression' => 'editedProduct.type === "grouped"',
);
}
if ( Features::is_enabled( 'product-external-affiliate' ) ) {
$variations_hide_conditions[] = array(
'expression' => 'editedProduct.type === "external"',
);
}
$this->add_group(
array(
'id' => $this::GROUP_IDS['VARIATIONS'],
'order' => 20,
'attributes' => array(
'title' => __( 'Variations', 'woocommerce' ),
),
'hideConditions' => $variations_hide_conditions,
)
);
}
$this->add_group(
array(
'id' => $this::GROUP_IDS['ORGANIZATION'],
'order' => 15,
'order' => 30,
'attributes' => array(
'title' => __( 'Organization', 'woocommerce' ),
),
@ -85,7 +112,7 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
$this->add_group(
array(
'id' => $this::GROUP_IDS['PRICING'],
'order' => 20,
'order' => 40,
'attributes' => array(
'title' => __( 'Pricing', 'woocommerce' ),
),
@ -99,7 +126,7 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
$this->add_group(
array(
'id' => $this::GROUP_IDS['INVENTORY'],
'order' => 30,
'order' => 50,
'attributes' => array(
'title' => __( 'Inventory', 'woocommerce' ),
),
@ -120,44 +147,20 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
$this->add_group(
array(
'id' => $this::GROUP_IDS['SHIPPING'],
'order' => 40,
'order' => 60,
'attributes' => array(
'title' => __( 'Shipping', 'woocommerce' ),
),
'hideConditions' => $shipping_hide_conditions,
)
);
if ( Features::is_enabled( 'product-variation-management' ) ) {
$variations_hide_conditions = array();
if ( Features::is_enabled( 'product-grouped' ) ) {
$variations_hide_conditions[] = array(
'expression' => 'editedProduct.type === "grouped"',
);
}
if ( Features::is_enabled( 'product-external-affiliate' ) ) {
$variations_hide_conditions[] = array(
'expression' => 'editedProduct.type === "external"',
);
}
$this->add_group(
array(
'id' => $this::GROUP_IDS['VARIATIONS'],
'order' => 50,
'attributes' => array(
'title' => __( 'Variations', 'woocommerce' ),
),
'hideConditions' => $variations_hide_conditions,
)
);
}
// Linked Products tab.
if ( Features::is_enabled( 'product-linked' ) ) {
$this->add_group(
array(
'id' => $this::GROUP_IDS['LINKED_PRODUCTS'],
'order' => 60,
'order' => 70,
'attributes' => array(
'title' => __( 'Linked products', 'woocommerce' ),
),