400 ) ); } // Load discount $discount_id = absint( $_GET['discount'] ); /** @var EDD_Discount */ $discount = edd_get_discount( $discount_id ); // Bail if discount does not exist if ( empty( $discount ) ) { wp_die( __( 'Something went wrong.', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 400 ) ); } // Setup discount vars $product_requirements = $discount->get_product_reqs(); $excluded_products = $discount->get_excluded_products(); $condition = $discount->get_product_condition(); $single_use = $discount->get_once_per_customer(); $type = $discount->get_type(); $notes = edd_get_discount_notes( $discount->id ); // Show/Hide $flat_display = ( 'flat' === $type ) ? '' : ' style="display:none;"'; $percent_display = ( 'percent' === $type ) ? '' : ' style="display:none;"'; $no_notes_display = empty( $notes ) ? '' : ' style="display:none;"'; $condition_display = ! empty( $product_requirements ) ? '' : ' style="display:none;"'; // Dates & times $discount_start_date = edd_get_edd_timezone_equivalent_date_from_utc( EDD()->utils->date( $discount->start_date, 'utc' ) ); $discount_end_date = edd_get_edd_timezone_equivalent_date_from_utc( EDD()->utils->date( $discount->end_date, 'utc' ) ); $start_date = $discount_start_date->format( 'Y-m-d' ); $start_hour = $discount_start_date->format( 'H' ); $start_minute = $discount_start_date->format( 'i' ); $end_date = $discount_end_date->format( 'Y-m-d' ); $end_hour = $discount_end_date->format( 'H' ); $end_minute = $discount_end_date->format( 'i' ); $hours = edd_get_hour_values(); $minutes = edd_get_minute_values(); ?>