PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / src / Addons / ReactProductEditorAddon / Sections / AdvanceProductOptionSection.php

AdvanceProductOptionSection.php in Tiered Pricing Table for WooCommerce 8.0.2, at src/Addons/ReactProductEditorAddon/Sections/AdvanceProductOptionSection.php

52 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\ReactProductEditorAddon\Sections;
2
3 use Automattic\WooCommerce\Admin\BlockTemplates\BlockTemplateInterface;
4 use Automattic\WooCommerce\Admin\Features\ProductBlockEditor\ProductTemplates\ProductFormTemplateInterface;
5 use Automattic\WooCommerce\Admin\Features\ProductBlockEditor\ProductTemplates\SectionInterface;
6 use TierPricingTable\Addons\ReactProductEditorAddon\TieredPricingGroup;
7
8 class AdvanceProductOptionSection {
9
10 const ID = 'tiered-pricing-table/product-editor-advance-product-option-section';
11
12 /**
13 * Section instance
14 *
15 * @var ?SectionInterface
16 */
17 public $sectionInstance = null;
18
19 public function __construct() {
20 add_action( 'woocommerce_block_template_register', array( $this, 'register' ) );
21 }
22
23 public function register( BlockTemplateInterface $template ) {
24
25 if ( $template instanceof ProductFormTemplateInterface && in_array( $template->get_id(),
26 $this->getSupportedProductTypes() ) ) {
27
28 $group = $template->get_group_by_id( TieredPricingGroup::ID );
29
30 if ( ! $group ) {
31 return;
32 }
33
34 $this->sectionInstance = $group->add_section( array(
35 'id' => self::ID,
36 'order' => 30,
37 'attributes' => array(
38 'title' => __( 'Advanced Options', 'tier-pricing-table' ),
39 'description' => __( 'Override global settings such as pricing layout for this product.',
40 'tier-pricing-table' ),
41 'blockGap' => 'unit-40',
42 ),
43 ) );
44 }
45 }
46
47 public function getSupportedProductTypes(): array {
48 return apply_filters( 'tiered_pricing_table/product_editor/advanced-section/supported_types',
49 array( 'simple-product' ) );
50 }
51 }
52