| 1 |
<?php |
| 2 |
|
| 3 |
namespace StoreEngine\Shortcode; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
use StoreEngine\Utils\Formatting; |
| 10 |
use StoreEngine\Utils\Template; |
| 11 |
|
| 12 |
class ApplyCouponForm { |
| 13 |
public function __construct() { |
| 14 |
add_shortcode( 'storeengine_apply_coupon_form', array( $this, 'render_apply_coupon_form' ) ); |
| 15 |
} |
| 16 |
|
| 17 |
public function render_apply_coupon_form( array $attrs ) { |
| 18 |
if ( Formatting::string_to_bool( get_query_var( 'order_pay' ) ) ) { |
| 19 |
return ''; |
| 20 |
} |
| 21 |
|
| 22 |
$attributes = shortcode_atts( [ |
| 23 |
'placeholder' => __( 'Coupon Code', 'storeengine' ), |
| 24 |
'button_label' => __( 'Apply', 'storeengine' ), |
| 25 |
], $attrs ); |
| 26 |
|
| 27 |
ob_start(); |
| 28 |
Template::get_template( 'shortcode/apply-coupon-form.php', $attributes ); |
| 29 |
|
| 30 |
return ob_get_clean(); |
| 31 |
} |
| 32 |
} |
| 33 |
|