1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
<?php
class WC_Braintree_Meta_Box_Coupons {
public static function init() {
add_action( 'woocommerce_coupon_options', array( __CLASS__, 'output_options' ), 10, 2 );
add_action( 'woocommerce_coupon_options_save', array( __CLASS__, 'save' ), 10, 2 );
}
public static function output_options( $id, $coupon ) {
include 'views/html-coupon-data.php';
}
public static function save( $post_id, $coupon ) {
$props = array( wc_clean( $_POST['subscription_type'] ) );
foreach ( $props as $key => $value ) {
update_post_meta( $post_id, '_subscription_type', $value );
}
}
}
WC_Braintree_Meta_Box_Coupons::init();