| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Product addon Compatibility |
| 5 |
* |
| 6 |
* @package WPFunnels\Compatibility\Plugin |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace WPFunnels\Compatibility\Plugin; |
| 10 |
|
| 11 |
use WPFunnels\Wpfnl_functions; |
| 12 |
use WPFunnels\Traits\SingletonTrait; |
| 13 |
|
| 14 |
/** |
| 15 |
* Product addon Compatibility |
| 16 |
* |
| 17 |
* @package WPFunnels\Compatibility\Plugin |
| 18 |
*/ |
| 19 |
class ProductAddon extends PluginCompatibility{ |
| 20 |
use SingletonTrait; |
| 21 |
|
| 22 |
/** |
| 23 |
* Initiate Filters/Hook |
| 24 |
* |
| 25 |
* @since 3.3.2 |
| 26 |
*/ |
| 27 |
public function init() { |
| 28 |
add_filter('wpfunnels/allow_initiate_funnel_checkout', array($this, 'allow_initiate_funnel_checkout'), 10, 2 ); |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
/** |
| 33 |
* Determines whether to allow initiating the funnel checkout. |
| 34 |
* |
| 35 |
* @param bool $allow Whether to allow initiating the funnel checkout. |
| 36 |
* @param int $funnel_id The ID of the funnel. |
| 37 |
* @return bool Whether to allow initiating the funnel checkout. |
| 38 |
* |
| 39 |
* @since 3.3.2 |
| 40 |
*/ |
| 41 |
public function allow_initiate_funnel_checkout($allow, $funnel_id ){ |
| 42 |
$is_gbf = get_post_meta( $funnel_id, 'is_global_funnel', true ); |
| 43 |
if( 'yes' === $is_gbf ){ |
| 44 |
$allow = false; |
| 45 |
} |
| 46 |
return $allow; |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
/** |
| 51 |
* Check if Product addon is activated |
| 52 |
* |
| 53 |
* @return bool |
| 54 |
* @since 3.3.2 |
| 55 |
*/ |
| 56 |
public function maybe_activate() |
| 57 |
{ |
| 58 |
return defined('WCPA_VERSION'); |
| 59 |
} |
| 60 |
} |
| 61 |
|