ProductCondition.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Integrations\Elementor\Conditions; |
| 4 | |
| 5 | use ElementorPro\Modules\ThemeBuilder; |
| 6 | |
| 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | exit; // Exit if accessed directly. |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * Product Condition. |
| 13 | */ |
| 14 | class ProductCondition extends ThemeBuilder\Conditions\Post { |
| 15 | /** |
| 16 | * Get the type of the condition. |
| 17 | * |
| 18 | * @return void |
| 19 | */ |
| 20 | public function register_sub_conditions() { |
| 21 | parent::register_sub_conditions(); |
| 22 | |
| 23 | $this->register_sub_condition( new ProductSingle() ); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Check condition. |
| 28 | * |
| 29 | * @param array $args The arguments. |
| 30 | * |
| 31 | * @return bool |
| 32 | */ |
| 33 | public function check( $args ) { |
| 34 | if ( ! empty( get_query_var( 'surecart_current_product' ) ) ) { |
| 35 | return true; |
| 36 | } |
| 37 | |
| 38 | return parent::check( $args ); |
| 39 | } |
| 40 | } |
| 41 |