[Product Block Editor]: add Linked product sections. First approach. (#43013)
* add Linked products, Upsell section * changelog * add Cross-lens section * add links to the Upsell sections * changelog * fix lint issues * fix lint issus * fix linting issue :-| * check whether the linked product group is defined
This commit is contained in:
parent
7f2b1c42fd
commit
7be2481381
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: add
|
||||
|
||||
[Product Block Editor]: Add Linked Product sections
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: add
|
||||
|
||||
[Product Block Editor]: add Linked product sections. First approach.
|
|
@ -36,6 +36,7 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
|
|||
$this->add_inventory_group_blocks();
|
||||
$this->add_shipping_group_blocks();
|
||||
$this->add_variation_group_blocks();
|
||||
$this->add_linked_products_group_blocks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1104,4 +1105,50 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the linked products group blocks to the template.
|
||||
*/
|
||||
private function add_linked_products_group_blocks() {
|
||||
if ( ! Features::is_enabled( 'product-virtual-downloadable' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$linked_products_group = $this->get_group_by_id( $this::GROUP_IDS['LINKED_PRODUCTS'] );
|
||||
if ( ! isset( $linked_products_group ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$linked_products_group->add_section(
|
||||
array(
|
||||
'id' => 'product-linked-upsells-section',
|
||||
'order' => 10,
|
||||
'attributes' => array(
|
||||
'title' => __( 'Upsells', 'woocommerce' ),
|
||||
'description' => sprintf(
|
||||
/* translators: %1$s: Learn more about linked products. %2$s: Learn more about linked products.*/
|
||||
__( 'Upsells are typically products that are extra profitable or better quality or more expensive. Experiment with combinations to boost sales. %1$sLearn more about linked products.%2$s', 'woocommerce' ),
|
||||
'<br /><a href="https://woo.com/document/related-products-up-sells-and-cross-sells/" target="_blank" rel="noreferrer">',
|
||||
'</a>'
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$linked_products_group->add_section(
|
||||
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.*/
|
||||
__( 'By suggesting complementary products in the cart using cross-sells, you can significantly increase the average order value. %1$sLearn more about linked products.%2$s', 'woocommerce' ),
|
||||
'<br /><a href="https://woo.com/document/related-products-up-sells-and-cross-sells/" target="_blank" rel="noreferrer">',
|
||||
'</a>'
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue