PluginProbe
Tiered Pricing Table for WooCommerce / 7.1.7
Tiered Pricing Table for WooCommerce v7.1.7
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 / PluginsRecommendations / ConditionalLogicForProductAddons.php

ConditionalLogicForProductAddons.php in Tiered Pricing Table for WooCommerce 7.1.7, at src/Addons/PluginsRecommendations/ConditionalLogicForProductAddons.php

65 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\PluginsRecommendations;
2
3 class ConditionalLogicForProductAddons {
4
5 public function __construct() {
6
7 add_action( 'init', function () {
8
9 if ( class_exists( 'MeowCrew\AddonsConditions\AddonsConditionsPlugin' ) ) {
10 return;
11 }
12
13 add_action( 'woocommerce_product_addons_panel_before_options', array(
14 $this,
15 'renderConditionalBlock',
16 ), 10, 3 );
17
18 add_action( 'admin_footer', function () {
19 ?>
20 <script>
21 jQuery(document).on('change', '.wc-pao-addon-conditions-suggestment-enabled', (function (event) {
22 const checkbox = jQuery(event.target);
23 const conditionsContainer = checkbox.closest('.wc-pao-row-conditions-suggestment-settings').find('.wc-pao-addon-conditions-suggestment');
24
25 checkbox.is(':checked') ? conditionsContainer.show() : conditionsContainer.hide();
26 }));
27 </script>
28 <?php
29 } );
30 } );
31 }
32
33 public function renderConditionalBlock( $post, $currentAddon, $loop ) {
34 ?>
35 <div class="wc-pao-addons-secondary-settings">
36
37 <div class="wc-pao-row wc-pao-row-conditions-suggestment-settings">
38 <label for="wc-pao-addon-conditions-suggestment-enabled-<?php echo esc_attr( $loop ); ?>">
39
40 <input type="checkbox"
41 id="wc-pao-addon-conditions-suggestment-enabled-<?php echo esc_attr( $loop ); ?>"
42 class="wc-pao-addon-conditions-suggestment-enabled"/>
43
44 <?php esc_html_e( 'Conditional logic', 'tier-pricing-table' ); ?>
45 </label>
46
47 <div class="wc-pao-addon-conditions-suggestment" style="display:none;">
48 <div>
49 <p style="font-size: 13px; background: #f5f5f5; padding: 15px 10px;">
50 <?php
51 esc_html_e( 'Looking to provide condition logic for your add-ons?', 'tier-pricing-table' );
52 ?>
53 <a target="_blank"
54 href="https://wordpress.org/plugins/conditional-logic-for-woo-product-add-ons/">
55 <?php esc_html_e( 'Check out this page.', 'tier-pricing-table' ); ?>
56 </a>
57 </p>
58 </div>
59 </div>
60 </div>
61 </div>
62 <?php
63
64 }
65 }