function my_custom_checkout_field($checkout) { wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_style('jquery-ui', "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css", '', '', false); wp_enqueue_style('datepicker', plugins_url('/css/datepicker.css', __FILE__), '', '', false); /*print(' <link rel="stylesheet" type="text/css" href="' . plugins_url() . '/order-delivery-date-for-woocommerce/datepicker.css"> <script type="text/javascript" src="' . plugins_url() . '/order-delivery-date-for-woocommerce/datepicker.js"></script>' ); print('<script type="text/javascript" src="' . plugins_url() . '/order-delivery-date-for-woocommerce/initialize-datepicker.js"></script>');*/ echo '<script language="javascript">jQuery(document).ready(function(){ jQuery("#e_deliverydate").width("150px"); var formats = ["MM d, yy","MM d, yy"]; jQuery("#e_deliverydate").val("").datepicker({dateFormat: formats[1], minDate:1}); jQuery("#e_deliverydate").parent().after("<div id=\'order-desc\'></div>"); });</script>'; echo '<div id="my_custom_checkout_field" style="width: 202%; float: left;">'; woocommerce_form_field('e_deliverydate', array('type' => 'text', 'label' => __('Leveringsdato'), 'required' => false, 'placeholder' => __('Angiv dato')), $checkout->get_value('e_deliverydate')); echo '</div>'; }
function my_custom_checkout_field($checkout) { echo '<div id="my_custom_checkout_field"><h2>' . __('Please enter your NetID and password.') . '</h2>'; woocommerce_form_field('net_id', array('type' => 'text', 'class' => array('form-row form-row form-row-first validate-required'), 'label' => __('NetID:'), 'placeholder' => __('')), $checkout->get_value('net_id')); woocommerce_form_field('uofrpassword', array('type' => 'password', 'class' => array('form-row form-row form-row-first validate-required'), 'label' => __('Password:'******'placeholder' => __('')), $checkout->get_value('uofrpassword')); echo '</div>'; }
/** * Adds all necessary admin styles. * * @param array Array of Product types & their labels, excluding the Subscription product type. * @return array Array of Product types & their labels, including the Subscription product type. * @since 1.0 */ public static function registrations_checkout_fields($checkout) { global $woocommerce; $cart = $woocommerce->cart->get_cart(); $registrations = 1; foreach ($woocommerce->cart->get_cart() as $cart_item_key => $values) { $_product = $values['data']; if ($_product->is_type('variation') && $_product->parent->is_type('registrations')) { $qty = $values['quantity']; for ($i = 1; $i <= $qty; $i++, $registrations++) { if ($i == 1) { $date = get_post_meta($_product->variation_id, 'attribute_dates', true); if ($date) { echo '<div id="registrations_fields"><h2>' . sprintf(__('Participants in %s - %s', 'registrations-for-woocommerce'), $_product->parent->post->post_title, esc_html(apply_filters('woocommerce_variation_option_name', $date))) . '</h2>'; } else { echo '<div id="registrations_fields"><h2>' . sprintf(__('Participants in %s', 'registrations-for-woocommerce'), $_product->parent->post->post_title) . '</h2>'; } } echo "<h3>" . sprintf(__('Participant #%u', $registrations), $registrations) . '</h3>'; woocommerce_form_field('participant_name_' . $registrations, array('type' => 'text', 'class' => array('participant-name form-row-wide'), 'label' => __('Name', 'registrations-for-woocommerce'), 'placeholder' => __('Mary Anna', 'registrations-for-woocommerce')), $checkout->get_value('participant_name_' . $registrations)); woocommerce_form_field('participant_surname_' . $registrations, array('type' => 'text', 'class' => array('participant-surname form-row-wide'), 'label' => __('Surname', 'registrations-for-woocommerce'), 'placeholder' => __('Smith', 'registrations-for-woocommerce')), $checkout->get_value('participant_surname_' . $registrations)); woocommerce_form_field('participant_email_' . $registrations, array('type' => 'email', 'class' => array('participant-email form-row-wide'), 'label' => __('Email', 'registrations-for-woocommerce'), 'placeholder' => __('*****@*****.**', 'registrations-for-woocommerce')), $checkout->get_value('participant_email_' . $registrations)); if ($i == $qty) { echo '</div>'; } } } } }
/** * Add fields to checkout billing section * @param object $checkout * @return null */ public function add_checkout_billing_fields($checkout) { $default_value = ''; if ($value = get_user_meta(get_current_user_id(), 'cpf', true)) { $default_value = $value; } woocommerce_form_field('cpf', array('type' => 'text', 'class' => array('form-row-wide'), 'label' => __('CPF/CNPJ', 'odin'), 'required' => true), $default_value); }
function taxexempt_before_order_notes($checkout) { echo '<div style="clear: both"></div>'; echo '<h3>'; _e('Tax Exemption', 'woocommerce-super-simple-tax-exemption'); echo '</h3>'; woocommerce_form_field('tax_exempt_checkbox', array('type' => 'checkbox', 'class' => array('tax-exempt-checkbox'), 'label' => __('Tax Exempt', 'woocommerce-super-simple-tax-exemption')), $checkout->get_value('tax_exempt_checkbox')); woocommerce_form_field('tax_exempt_id', array('type' => 'text', 'class' => array('tax-exempt-id'), 'label' => __('Tax Exempt ID', 'woocommerce-super-simple-tax-exemption')), $checkout->get_value('tax_exempt_id')); }
/** * @action woocommerce_checkout_after_customer_details * * @used-by init */ public static function output_payer_field() { if (!self::is_bacs_enabled()) { return; } echo '<div class="col2-set">'; echo '<div class="col-1"> </div><div class="col-2">'; woocommerce_form_field('bacs_payer_name', array('type' => 'text', 'class' => array('form-row', 'form-row-wide'), 'label' => __('입금자 이름', 'wskl'), 'placeholder' => __('무통장 입금자 이름이 다를 경우', 'wskl'), 'required' => FALSE)); echo '</div></div>'; }
function woocommerce_billing_fields_ro($checkout) { echo '<div id="woocommerce_billing_fields_ro"> <h3 style="margin:0;padding:0;">' . __('Date facturare firmă') . '</h3> <p> </p>'; woocommerce_form_field('wbfr_cif', array('type' => 'text', 'class' => array('form-row-wide'), 'label' => __('CIF'), 'placeholder' => __('Cod de identificare fiscală')), $checkout->get_value('wbfr_cif')); woocommerce_form_field('wbfr_regcom', array('type' => 'text', 'class' => array('form-row-wide'), 'label' => __('Nr. înregistrare Registrul Comerțului'), 'placeholder' => __('Nr. înregistrare Registrul Comerțului')), $checkout->get_value('wbfr_regcom')); woocommerce_form_field('wbfr_cont_banca', array('type' => 'text', 'class' => array('form-row-wide'), 'label' => __('Cont bancar'), 'placeholder' => __('Cont bancar')), $checkout->get_value('wbfr_cont_banca')); woocommerce_form_field('wbfr_banca', array('type' => 'text', 'class' => array('form-row-wide'), 'label' => __('Banca'), 'placeholder' => __('Banca')), $checkout->get_value('wbfr_banca')); echo '</div>'; }
/** * This displays a checkbox field on the checkout * page to allow the customer to subscribe to newsletters. */ function on_checkout_page($checkout) { // Checks if subscribe on checkout is enabled. $enable_checkout = get_option('mailpoet_woocommerce_enable_checkout'); $checkout_label = get_option('mailpoet_woocommerce_checkout_label'); if ($enable_checkout == 'yes') { echo '<div id="mailpoet_checkout_field">'; woocommerce_form_field('mailpoet_checkout_subscribe', array('type' => 'checkbox', 'class' => array('mailpoet-checkout-class form-row-wide'), 'label' => htmlspecialchars(stripslashes($checkout_label))), $checkout->get_value('mailpoet_checkout_subscribe')); echo '</div>'; } }
function wsr_custom_checkout_fields($fields) { if ($this->textboxKey) { woocommerce_form_field('wsr_order_textbox', array('type' => 'text', 'label' => $this->textboxLabel, 'required' => true, 'class' => array('form-row-wide')), $fields->get_value('wsr_order_textbox')); } if ($this->checkboxKey) { woocommerce_form_field('wsr_order_checkbox', array('type' => 'checkbox', 'label' => $this->checkboxLabel, 'required' => true, 'class' => array('input-checkbox')), $fields->get_value('wsr_order_checkbox')); } if ($this->selectKey) { woocommerce_form_field('wsr_order_select', array('type' => 'select', 'label' => $this->selectLabel, 'required' => true, 'class' => array('form-row-wide'), 'options' => $this->selectOptions), $fields->get_value('wsr_order_select')); } }
function anotes($c) { global $woocommerce; $items = $woocommerce->cart->cart_contents; if (!has_commands($items)) { return; } ?> <div id="woo_minecraft"><?php woocommerce_form_field('player_id', array('type' => 'text', 'class' => array(), 'label' => 'Player ID:', 'placeholder' => 'Required Field'), $c->get_value('player_id')); ?> </div><?php }
function wt_attendee_details($checkout) { $attendee_count = wt_count_attendees(); if ($attendee_count > 0) { echo "</div></div>"; //close the Billing Address section to create new group of fields echo "<div id='attendee_details'><div>"; //automatically be closed from 2 Billing Address's div - </div></div> echo '<h3>' . __('Participants') . '</h3>'; for ($n = 1; $n <= $attendee_count; $n++) { woocommerce_form_field('attendee_name_' . $n, array('type' => 'text', 'class' => array('form-row form-row-first'), 'label' => __('Name'), 'placeholder' => __(''), 'required' => true), $checkout->get_value('attendee_name_' . $n)); woocommerce_form_field('attendee_email_' . $n, array('type' => 'text', 'class' => array('form-row form-row-last validate-email'), 'label' => __('NI Number'), 'placeholder' => __(''), 'required' => false), $checkout->get_value('attendee_email_' . $n)); } } //echo "Attendees: " . $attendee_count; }
function klarna_checkout_order_note() { global $woocommerce; $field = array('type' => 'textarea', 'label' => __('Order Notes', 'woocommerce'), 'placeholder' => _x('Notes about your order, e.g. special notes for delivery.', 'placeholder', 'woocommerce'), 'class' => array('notes')); if (WC()->session->get('klarna_order_note')) { $order_note = WC()->session->get('klarna_order_note'); } else { $order_note = ''; } ob_start(); if (sizeof(WC()->cart->get_cart()) > 0) { echo '<div class="woocommerce"><form>'; woocommerce_form_field('kco_order_note', $field, $order_note); echo '</form></div>'; } return ob_get_clean(); }
function giftcard_custom_checkout_field() { global $post; session_start(); //this is to set the "session" cookie of the price //ONLY add new form/user-input-field to the page ID of 548 (Gift Cards) if (get_post_meta($post->ID, _cmb_custom_user_input_for_woocommerce, true)) { // Set Input woocommerce_form_field('giftCardInput', array('type' => 'text', 'class' => array('gift-card-input'), 'label' => 'Please enter an amount:', 'placeholder' => 'Enter a number here', 'maxlength' => 8)); //Get the value from the input box upon add to cart click (do not pass value if it's empty/null) if (!empty($_POST[giftCardInput])) { $_SESSION['giftCardInput'] = $_POST[giftCardInput]; $_SESSION['giftCardInput'] = str_replace("\$", "", $_SESSION['giftCardInput']); global $wpdb; $table_name = $wpdb->prefix . 'mstar_woo_user_input'; $wpdb->insert($table_name, array('UID' => $_SESSION['giftCardUID'], 'price' => $_SESSION['giftCardInput'])); } } }
/** * Outputs the necessary markup on the "My Account" > "Edit Address" page for editing a single subscription's * address or to check if the customer wants to update the addresses for all of their subscriptions. * * If editing their default shipping address, this function adds a checkbox to the to allow subscribers to * also update the address on their active subscriptions. If editing a single subscription's address, the * subscription key is added as a hidden field. * * @since 1.3 */ public static function maybe_add_edit_address_checkbox() { global $wp; if (wcs_user_has_subscription()) { if (isset($_GET['subscription'])) { echo '<p>' . esc_html__('Both the shipping address used for the subscription and your default shipping address for future purchases will be updated.', 'woocommerce-subscriptions') . '</p>'; echo '<input type="hidden" name="update_subscription_address" value="' . absint($_GET['subscription']) . '" id="update_subscription_address" />'; } elseif (isset($wp->query_vars['edit-address']) && !empty($wp->query_vars['edit-address']) || isset($_GET['address'])) { if (isset($wp->query_vars['edit-address'])) { $address_type = esc_attr($wp->query_vars['edit-address']) . ' '; } else { $address_type = !isset($_GET['address']) ? esc_attr($_GET['address']) . ' ' : ''; } $label = sprintf(__('Update the %s address used for %sall%s of my active subscriptions', 'woocommerce-subscriptions'), $address_type, '<strong>', '</strong>'); woocommerce_form_field('update_all_subscriptions_addresses', array('type' => 'checkbox', 'class' => array('form-row-wide'), 'label' => $label)); } wp_nonce_field('wcs_edit_address', '_wcsnonce'); } }
function autorent_flight_no_custom_checkout_field($checkout) { woocommerce_form_field('imperial_flight_no', array('type' => 'text', 'class' => array('my-field-class form-row-wide'), 'label' => __('Flight Number'), 'placeholder' => __('Enter Flight Number')), $checkout->get_value('imperial_flight_no')); }
</option> <?php } ?> </select> </p> <div class="shipping_address address_block" id="shipping_address"> <?php do_action('woocommerce_before_checkout_shipping_form', $checkout); ?> <div class="address-column"> <?php foreach ($shipFields as $key => $field) { $val = ''; $key = 'address[' . $key . ']'; woocommerce_form_field($key, $field, $val); } do_action('woocommerce_after_checkout_shipping_form', $checkout); ?> </div> </div> <input type="submit" id="duplicate_cart" class="button" value="<?php _e('Duplicate Cart Items', 'wc_shipping_multiple_address'); ?> " /> </form> </div>
/** * Render the payment, a simple wrapper around woocommerce_form_field() to * make it more convenient for concrete gateways to override form output * * @since 4.1.2 * @param array $field */ protected function render_payment_field($field) { woocommerce_form_field($field['name'], $field, $field['value']); }
][option_a]" value="<?php echo esc_attr($options['buttons'][$i][option_a]); ?> " /></td> <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?> ][option_b]" value="<?php echo esc_attr($options['buttons'][$i][option_b]); ?> " /></td> <td> <select name="wccs_settings[buttons][<?php echo $i; ?> ][type]" > <!--Call run() function--> <option value="text" <?php selected($options['buttons'][$i][type], 'text'); ?> >Text Input</option> <option value="select" <?php selected($options['buttons'][$i][type], 'select'); ?> >Select Options</option> <option value="date" <?php selected($options['buttons'][$i][type], 'date'); ?> >Date Picker</option> <option value="checkbox" <?php
<form action="<?php echo esc_url(add_query_arg('address', $load_address, get_permalink(woocommerce_get_page_id('edit_address')))); ?> " method="post"> <h3><?php if ($load_address == 'billing') { _e('Billing Address', 'woocommerce'); } else { _e('Shipping Address', 'woocommerce'); } ?> </h3> <?php foreach ($address as $key => $field) { woocommerce_form_field($key, $field, get_user_meta(get_current_user_id(), $key, true)); } ?> <input type="submit" class="button" name="save_address" value="<?php _e('Save Address', 'woocommerce'); ?> " /> <?php $woocommerce->nonce_field('edit_address'); ?> <input type="hidden" name="action" value="edit_address" /> </form>
function duplicate_cart_ajax() { global $woocommerce; $this->load_cart_files(); $checkout = new WC_Checkout(); $cart = $woocommerce->cart; $user = wp_get_current_user(); $shipFields = $woocommerce->countries->get_address_fields($woocommerce->countries->get_base_country(), 'shipping_'); $address = $_POST['address']; $add_id = isset($_POST['address_id']) && !empty($_POST['address_id']) ? $_POST['address_id'] : false; $add = $this->duplicate_cart(); $addresses = $this->get_user_addresses($user); if ($add_id !== false) { $address = $addresses[$add_id]; $id = $add_id; } else { $address = $_POST['address']; $id = rand(100, 1000); } foreach ($address as $key => $value) { $new_key = str_replace('shipping_', '', $key); $address[$new_key] = $value; } $formatted_address = wcms_get_formatted_address($address); $json_address = json_encode($address); //if (!$formatted_address) continue; if ($user->ID > 0) { $vals = ''; foreach ($address as $key => $value) { $vals .= $value; } $md5 = md5($vals); $saved = false; foreach ($addresses as $addr) { $vals = ''; if (!is_array($addr)) { continue; } foreach ($addr as $key => $value) { $vals .= $value; } $addrMd5 = md5($vals); if ($md5 == $addrMd5) { // duplicate address! $saved = true; break; } } if (!$saved && !$add_id) { // address is unique, save! $id = count($addresses); $addresses[] = $address; $this->save_user_addresses($user->ID, $addresses); } } $html = ' <div class="account-address"> <address>' . $formatted_address . '</address> <div style="display: none;">'; ob_start(); foreach ($shipFields as $key => $field) { $val = isset($address[$key]) ? $address[$key] : ''; $key .= '_' . $id; woocommerce_form_field($key, $field, $val); } do_action('woocommerce_after_checkout_shipping_form', $checkout); $html .= ob_get_clean(); $html .= ' <input type="hidden" name="addresses[]" value="' . $id . '" /> <textarea style="display:none;">' . $json_address . '</textarea> </div> <ul class="items-column" id="items_column_' . $id . '">'; foreach ($add as $product) { $html .= ' <li data-product-id="' . $product['id'] . '" data-key="' . $product['key'] . '" class="address-item address-item-' . $product['id'] . ' address-item-key-' . $product['key'] . '"> <span class="qty">' . $product['qty'] . '</span> <h3 class="title">' . get_the_title($product['id']) . '</h3> ' . $woocommerce->cart->get_item_data($product['content']); for ($item_qty = 0; $item_qty < $product['qty']; $item_qty++) { $html .= '<input type="hidden" name="items_' . $id . '[]" value="' . $product['key'] . '">'; } $html .= '<a class="remove" href="#"><img style="width: 16px; height: 16px;" src="' . plugins_url('images/delete.png', self::FILE) . '" class="remove" title="' . __('Remove', 'wc_shipping_multiple_address') . '"></a> </li>'; } $html .= ' </ul> </div> '; $return = json_encode(array('ack' => 'OK', 'id' => $id, 'html' => $html)); die($return); exit; }
/** * Add the local pickup time field to the checkout page * * @since 1.0.0 */ public function time_select($checkout) { echo '<div id="local-pickup-time-select"><h3>' . __('Pickup Time', $this->plugin_slug) . '</h3>'; woocommerce_form_field('local_pickup_time_select', array('type' => 'select', 'class' => array('local-pickup-time-select-field form-row-wide'), 'label' => __('Pickup Time', $this->plugin_slug), 'options' => self::create_hour_options()), $checkout->get_value('local_pickup_time_select')); self::create_hour_options(); echo '</div>'; }
function siw_wc_checkout_extra_information() { $checkout = WC()->checkout(); //lijsten van talen en niveau $languages = siw_get_array('languages'); $language_skill = siw_get_array('language_skill'); echo '<h1>Informatie voor partner</h1>'; echo '<div class="woocommerce-extra-fields">'; echo '<div id="infoForPartner"><h3>' . __('Informatie voor partnerorganisatie') . '</h3>'; woocommerce_form_field('motivation', array('type' => 'textarea', 'class' => array('form-row-first'), 'required' => true, 'label' => __('Motivation', 'siw'), 'placeholder' => __('Vul hier (in het Engels) in waarom je graag aan je gekozen project wil deelnemen.')), $checkout->get_value('motivation')); woocommerce_form_field('healthIssues', array('type' => 'textarea', 'class' => array('form-row-last'), 'required' => false, 'clear' => true, 'label' => __('Allergies/diet/health issues', 'siw'), 'placeholder' => __('Heb je een allergie, gebruik je medicijnen of volg je een diëet, vul dat dan hier in (in het Engels).', 'siw')), $checkout->get_value('healthIssues')); woocommerce_form_field('volunteerExperience', array('type' => 'textarea', 'class' => array('form-row-first'), 'required' => false, 'label' => __('Volunteer experience', 'siw'), 'placeholder' => __('Heb je eerder vrijwilligerswerk gedaan? Beschrijf dat dan hier (in het Engels).', 'siw')), $checkout->get_value('volunteerExperience')); woocommerce_form_field('togetherWith', array('type' => 'text', 'class' => array('form-row-last'), 'required' => false, 'clear' => true, 'label' => __('Together with', 'siw'), 'placeholder' => __('Wil je graag met iemand aan een project deelnemen. Vul zijn of haar naam dan hier in.', 'siw')), $checkout->get_value('togetherWith')); echo '</div>'; // gegevens noodcontact echo '<div id="emergencyContact"><h3>' . __('Noodcontact') . '</h3>'; woocommerce_form_field('emergencyContactName', array('type' => 'text', 'class' => array('form-row-first'), 'required' => true, 'label' => __('Naam', 'siw')), $checkout->get_value('emergencyContactName')); woocommerce_form_field('emergencyContactPhone', array('type' => 'text', 'class' => array('form-row-last'), 'required' => true, 'label' => __('Telefoonnummer', 'siw'), 'clear' => true), $checkout->get_value('emergencyContactPhone')); echo '</div>'; echo '<div id="languageSkills"><h3>' . __('Talenkennis') . '</h3>'; woocommerce_form_field('language1', array('type' => 'select', 'class' => array('form-row-first'), 'label' => __('Taal 1', 'siw'), 'required' => true, 'clear' => true, 'options' => $languages), $checkout->get_value('language1')); woocommerce_form_field('language1Skill', array('type' => 'radio', 'class' => array('form-row-wide'), 'label' => __('Niveau taal 1', 'siw'), 'required' => true, 'clear' => true, 'options' => $language_skill), $checkout->get_value('language1Skill')); woocommerce_form_field('language2', array('type' => 'select', 'class' => array('form-row-first'), 'label' => __('Taal 2', 'siw'), 'required' => false, 'clear' => true, 'options' => $languages), $checkout->get_value('language2')); woocommerce_form_field('language2Skill', array('type' => 'radio', 'class' => array('form-row-wide'), 'label' => __('Niveau taal 2', 'siw'), 'required' => false, 'clear' => true, 'options' => $language_skill), $checkout->get_value('language2Skill')); woocommerce_form_field('language3', array('type' => 'select', 'class' => array('form-row-first'), 'label' => __('Taal 3', 'siw'), 'required' => false, 'clear' => true, 'options' => $languages), $checkout->get_value('language3')); woocommerce_form_field('language3Skill', array('type' => 'radio', 'class' => array('form-row-wide'), 'label' => __('Niveau taal 3', 'siw'), 'required' => false, 'clear' => true, 'options' => $language_skill), $checkout->get_value('language3Skill')); echo '</div>'; echo '</div>'; }
function wccs_custom_checkout_field($checkout) { woocommerce_form_field('latitude', array('type' => 'text', 'label' => 'Latitude', 'required' => 1, 'placeholder' => 'Latitude'), $checkout->get_value('latitude')); woocommerce_form_field('longitude', array('type' => 'text', 'label' => 'Longitude', 'required' => 1, 'placeholder' => 'Longitude'), $checkout->get_value('longitude')); }
<div class="create-account"> <p><?php _e('Create an account by entering the information below. If you are a returning customer please login at the top of the page.', 'woocommerce'); ?> </p> <?php foreach ($checkout->checkout_fields['account'] as $key => $field) { ?> <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?> <?php } ?> <div class="clear"></div> </div> <?php do_action('woocommerce_after_checkout_registration_form', $checkout); ?>
function siw_woo_checkout_newsletter_checkbox() { $checkout = WC()->checkout(); woocommerce_form_field('newsletter_signup', array('type' => 'checkbox', 'class' => array('form-row-wide'), 'clear' => true, 'label' => __('Ja, ik wil graag de SIW nieuwsbrief ontvangen', 'siw')), $checkout->get_value('newsletter_signup')); }
/** * This displays a checkbox field on the checkout * page to allow the customer to subscribe to newsletters. * * If the admin has enabled the customer to select the newsletters * then display a checkbox for each list available. * * @since 1.0.0 * @version 3.0.0 * @filter mailpoet_woocommerce_subscription_section_title * @uses woocommerce_form_field() * @uses mailpoet_lists() * @uses is_user_logged_in() * @uses get_user_meta() * @uses get_current_user_id() */ function on_checkout_page() { $enable_checkout = get_option('mailpoet_woocommerce_enable_checkout'); // Is the add-on enabled? $customer_selects = get_option('mailpoet_woocommerce_customer_selects'); // Multi-Subscriptions $checkbox_status = get_option('mailpoet_woocommerce_checkbox_status'); // Checkbox Status $subscription_lists = get_option('mailpoet_woocommerce_subscribe_too'); // Subscription Lists selected $field_value = $checkbox_status == 'checked' ? 1 : 0; // Field Value /** * If the add-on is enabled and at least one list has been * selected. Display the subscription fields on the * checkout page. */ if ($enable_checkout == 'yes' && !empty($subscription_lists)) { // If the user is logged in and has already subscribed, don't show the subscription fields. if (is_user_logged_in() && get_user_meta(get_current_user_id(), '_mailpoet_wc_subscribed_to_newsletter', true)) { return false; } echo '<div id="mailpoet_subscription_section">'; echo '<h3>' . apply_filters('mailpoet_woocommerce_subscription_section_title', __('Subscribe to Newsletter/s', 'mailpoet-woocommerce-add-on')) . '</h3>'; // Customer can select more than one newsletter. if ($customer_selects == 'yes') { foreach (mailpoet_lists() as $key => $list) { $list_id = $list['list_id']; // List ID number $list_name = $list['name']; // List Name // Checks if the list was selected in the add-on settings before showing the checkbox field. if (in_array($list_id, $subscription_lists)) { mailpoet_woocommerce_form_field('mailpoet_checkout_subscription', array('id' => 'list-' . $list_id, 'type' => 'multicheckbox', 'class' => array('mailpoet-checkout-class form-row-wide'), 'label' => htmlspecialchars(stripslashes($list_name)), 'status' => $checkbox_status), $list_id); } } } else { $checkout_label = get_option('mailpoet_woocommerce_checkout_label'); // Subscribe Checkbox Label $checkout_label = !empty($checkout_label) ? $checkout_label : __('Yes, please subscribe me to the newsletter/s.', 'mailpoet-woocommerce-add-on'); // Puts default label if not set in the settings. woocommerce_form_field('mailpoet_checkout_subscribe', array('type' => 'checkbox', 'class' => array('mailpoet-checkout-class form-row-wide'), 'label' => htmlspecialchars(stripslashes($checkout_label))), $field_value); } // END if $customer_selects echo '</div>'; } // END if $enabled_checkout }
} else { ?> <form method="post"> <h3><?php echo apply_filters('woocommerce_my_account_edit_address_title', $page_title); ?> </h3> <?php foreach ($address as $key => $field) { ?> <?php woocommerce_form_field($key, $field, !empty($_POST[$key]) ? wc_clean($_POST[$key]) : $field['value']); ?> <?php } ?> <p> <input type="submit" class="btn btn-danger" name="save_address" value="<?php _e('Save Address', 'woocommerce'); ?> " /> <?php wp_nonce_field('woocommerce-edit_address'); ?> <input type="hidden" name="action" value="edit_address" />
/** * Output the payment method widget HTML */ public function payment_widget() { $checkout = WC_Checkout::instance(); ?> <div class="col-2"> <h3><?php _e('Payment Method', 'woocommerce'); ?> </h3> <div id="amazon_wallet_widget"></div> <input type="hidden" name="amazon_reference_id" value="<?php echo $this->reference_id; ?> " /> </div> </div> <?php if (!is_user_logged_in() && $checkout->enable_signup) { ?> <?php if ($checkout->enable_guest_checkout) { ?> <p class="form-row form-row-wide create-account"> <input class="input-checkbox" id="createaccount" <?php checked(true === $checkout->get_value('createaccount') || true === apply_filters('woocommerce_create_account_default_checked', false), true); ?> type="checkbox" name="createaccount" value="1" /> <label for="createaccount" class="checkbox"><?php _e('Create an account?', 'woocommerce-gateway-amazon-payments-advanced'); ?> </label> </p> <?php } ?> <?php do_action('woocommerce_before_checkout_registration_form', $checkout); ?> <?php if (!empty($checkout->checkout_fields['account'])) { ?> <div class="create-account"> <h3><?php _e('Create Account', 'woocommerce-gateway-amazon-payments-advanced'); ?> </h3> <p><?php _e('Create an account by entering the information below. If you are a returning customer please login at the top of the page.', 'woocommerce-gateway-amazon-payments-advanced'); ?> </p> <?php foreach ($checkout->checkout_fields['account'] as $key => $field) { ?> <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?> <?php } ?> <div class="clear"></div> </div> <?php } ?> <?php do_action('woocommerce_after_checkout_registration_form', $checkout); ?> <?php } ?> <?php }
*/ ?> <div class="contribution-comment-form"> <form action="<?php echo site_url('/wp-comments-post.php'); ?> " method="post" enctype="multipart/form-data" novalidate> <?php foreach (wc_product_reviews_pro()->frontend->get_contribution_fields('contribution_comment') as $key => $field) { ?> <?php woocommerce_form_field($key, $field); ?> <?php } ?> <input type="hidden" name="comment_type" value="contribution_comment" /> <input type="hidden" name="comment_post_ID" value="<?php the_ID(); ?> "> <input type="hidden" name="comment_parent" value="<?php echo $comment->comment_ID; ?> ">
/** * Outputs the necessary markup on the "My Account" > "Edit Address" page for editing a single subscription's * address or to check if the customer wants to update the addresses for all of their subscriptions. * * If editing their default shipping address, this function adds a checkbox to the to allow subscribers to * also update the address on their active subscriptions. If editing a single subscription's address, the * subscription key is added as a hidden field. * * @param string $template_name The name of the template that is being loaded * @since 1.3 */ public static function maybe_add_edit_address_checkbox($template_name) { if ('myaccount/form-edit-address.php' === $template_name) { if (isset($_GET['subscription'])) { printf(__('%sBoth the shipping address used for the subscription and your default shipping address for future purchases will be updated.%s', 'woocommerce-subscriptions'), '<p>', '</p>'); echo '<input type="hidden" name="update_subscription_address" value="' . esc_attr($_GET['subscription']) . '" id="update_subscription_address" />'; } elseif (isset($_GET['address']) && WC_Subscriptions_Manager::user_has_subscription()) { $address_type = esc_attr($_GET['address']); $label = sprintf(__('Update the %s address used for <strong>all</strong> of my active subscriptions', 'woocommerce-subscriptions'), $address_type); woocommerce_form_field('update_all_subscriptions_addresses', array('type' => 'checkbox', 'class' => array('form-row-wide'), 'label' => $label)); } // No hooks within the "Edit Address" form so need to move it client side ?> <script type="text/javascript"> jQuery(document).ready(function($){ var $field; if($('#update_all_subscriptions_addresses_field').length > 0) $field = $('#update_all_subscriptions_addresses_field'); else $field = $('#update_subscription_address'); $field.insertBefore($('input[name="save_address"]').parent()); }); </script> <?php } }