'; if ( edd_get_cart_contents() || edd_cart_has_fees() ) : edd_checkout_cart(); ?>
'; return ob_get_clean(); } /** * Renders the Purchase Form, hooks are provided to add to the purchase form. * The default Purchase Form rendered displays a list of the enabled payment * gateways, a user registration form (if enable) and a credit card info form * if credit cards are enabled * * @since 1.4 * @return string */ function edd_show_purchase_form() { $payment_mode = edd_get_chosen_gateway(); /** * Hooks in at the top of the purchase form * * @since 1.4 */ do_action( 'edd_purchase_form_top' ); if ( edd_can_checkout() ) { do_action( 'edd_purchase_form_before_register_login' ); $show_register_form = edd_get_option( 'show_register_form', 'none' ) ; if( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
0 ) { // Load the credit card form and allow gateways to load their own if they wish if ( has_action( 'edd_' . $payment_mode . '_cc_form' ) ) { do_action( 'edd_' . $payment_mode . '_cc_form' ); } else { do_action( 'edd_cc_form' ); } } /** * Hooks in after Credit Card Form * * @since 1.4 */ do_action( 'edd_purchase_form_after_cc_form' ); } else { // Can't checkout do_action( 'edd_purchase_form_no_access' ); } /** * Hooks in at the bottom of the purchase form * * @since 1.4 */ do_action( 'edd_purchase_form_bottom' ); } add_action( 'edd_purchase_form', 'edd_show_purchase_form' ); /** * Shows the User Info fields in the Personal Info box, more fields can be added * via the hooks provided. * * @since 1.3.3 * @return void */ function edd_user_info_fields() { $customer = EDD()->session->get( 'customer' ); $customer = wp_parse_args( $customer, array( 'first_name' => '', 'last_name' => '', 'email' => '' ) ); if( is_user_logged_in() ) { $user_data = get_userdata( get_current_user_id() ); foreach( $customer as $key => $field ) { if ( 'email' == $key && empty( $field ) ) { $customer[ $key ] = $user_data->user_email; } elseif ( empty( $field ) ) { $customer[ $key ] = $user_data->$key; } } } $customer = array_map( 'sanitize_text_field', $customer ); ?>

/>

aria-describedby="edd-first-description" />

aria-describedby="edd-last-description"/>

/

session->get( 'customer' ); $customer = wp_parse_args( $customer, array( 'address' => array( 'line1' => '', 'line2' => '', 'city' => '', 'zip' => '', 'state' => '', 'country' => '' ) ) ); $customer['address'] = array_map( 'sanitize_text_field', $customer['address'] ); if( $logged_in ) { $user_address = get_user_meta( get_current_user_id(), '_edd_user_address', true ); foreach( $customer['address'] as $key => $field ) { if ( empty( $field ) && ! empty( $user_address[ $key ] ) ) { $customer['address'][ $key ] = $user_address[ $key ]; } else { $customer['address'][ $key ] = ''; } } } ob_start(); ?>

/>

/>

/>

/>

$gateway ) : $label = apply_filters( 'edd_gateway_checkout_label_' . $gateway_id, $gateway['checkout_label'] ); $checked = checked( $gateway_id, $chosen_gateway, false ); $checked_class = $checked ? ' edd-gateway-option-selected' : ''; echo ''; endforeach; do_action( 'edd_payment_mode_after_gateways' ); ?>

'; foreach( $payment_methods as $key => $card ) { if( edd_string_is_image_url( $key ) ) { echo ''; } else { $card = strtolower( str_replace( ' ', '', $card ) ); if( has_filter( 'edd_accepted_payment_' . $card . '_image' ) ) { $image = apply_filters( 'edd_accepted_payment_' . $card . '_image', '' ); } else { $image = edd_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.png', false ); $content_dir = WP_CONTENT_DIR; if( function_exists( 'wp_normalize_path' ) ) { // Replaces backslashes with forward slashes for Windows systems $image = wp_normalize_path( $image ); $content_dir = wp_normalize_path( $content_dir ); } $image = str_replace( $content_dir, content_url(), $image ); } if( edd_is_ssl_enforced() || is_ssl() ) { $image = edd_enforced_ssl_asset_filter( $image ); } echo ''; } } echo ''; } add_action( 'edd_payment_mode_top', 'edd_show_payment_icons' ); add_action( 'edd_checkout_form_top', 'edd_show_payment_icons' ); /** * Renders the Discount Code field which allows users to enter a discount code. * This field is only displayed if there are any active discounts on the site else * it's not displayed. * * @since 1.2.2 * @return void */ function edd_discount_field() { if( isset( $_GET['payment-mode'] ) && edd_is_ajax_disabled() ) { return; // Only show before a payment method has been selected if ajax is disabled } if( ! edd_is_checkout() ) { return; } if ( edd_has_active_discounts() && edd_get_cart_total() ) : $color = edd_get_option( 'checkout_color', 'blue' ); $color = ( $color == 'inherit' ) ? '' : $color; $style = edd_get_option( 'button_style', 'button' ); ?>