当前位置: 首页>>代码示例>>PHP>>正文


PHP woocommerce_form_field函数代码示例

本文整理汇总了PHP中woocommerce_form_field函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_form_field函数的具体用法?PHP woocommerce_form_field怎么用?PHP woocommerce_form_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了woocommerce_form_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: my_custom_checkout_field

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>';
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:20,代码来源:order_delivery_date.php

示例2: my_custom_checkout_field

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>';
}
开发者ID:karyband,项目名称:Rettner-Website,代码行数:7,代码来源:rettner-plugin.php

示例3: registrations_checkout_fields

 /**
  * 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' => __('mary@anna.com.br', 'registrations-for-woocommerce')), $checkout->get_value('participant_email_' . $registrations));
                 if ($i == $qty) {
                     echo '</div>';
                 }
             }
         }
     }
 }
开发者ID:HasteDesign,项目名称:Registrations-for-WooCommerce,代码行数:36,代码来源:class-wc-registrations-checkout.php

示例4: maybe_add_edit_address_checkbox

    /**
     * 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 
        }
    }
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:39,代码来源:class-wc-subscriptions-addresses.php

示例5: add_checkout_billing_fields

 /**
  * 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);
 }
开发者ID:brasadesign,项目名称:aboaterra-theme,代码行数:13,代码来源:class-extra-fields.php

示例6: taxexempt_before_order_notes

 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'));
 }
开发者ID:seangreen,项目名称:woocommerce-super-simple-tax-exempt-plugin,代码行数:9,代码来源:simple-tax-exemption.php

示例7: output_payer_field

 /**
  * @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">&nbsp;</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>';
 }
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:15,代码来源:class-wskl-bacs-payer-name.php

示例8: woocommerce_billing_fields_ro

 function woocommerce_billing_fields_ro($checkout)
 {
     echo '<div id="woocommerce_billing_fields_ro">
             <h3 style="margin:0;padding:0;">' . __('Date facturare firmă') . '</h3>
             <p>&nbsp;</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>';
 }
开发者ID:neamtua,项目名称:woocommerce-billing-fields-ro,代码行数:11,代码来源:woocommerce-billing-fields-ro.php

示例9: on_checkout_page

/**
 * 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>';
    }
}
开发者ID:rinodung,项目名称:live-theme,代码行数:15,代码来源:mailpoet-woocommerce-core-functions.php

示例10: wsr_custom_checkout_fields

 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'));
     }
 }
开发者ID:n83b,项目名称:wsr-woo-checkout-fields,代码行数:12,代码来源:wsr-woo-checkout-fields.php

示例11: anotes

        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 
        }
开发者ID:HappyHarm,项目名称:WooMinecraft,代码行数:13,代码来源:main.class.php

示例12: wt_attendee_details

 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;
 }
开发者ID:pellio11,项目名称:ns-select-project,代码行数:16,代码来源:wootickets-attendees-list.php

示例13: klarna_checkout_order_note

 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();
 }
开发者ID:NoviumDesign,项目名称:polefitness,代码行数:17,代码来源:class-klarna-shortcodes.php

示例14: giftcard_custom_checkout_field

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']));
        }
    }
}
开发者ID:ecs87,项目名称:MStar-Woo-User-Input,代码行数:19,代码来源:MWUI.php

示例15: maybe_add_edit_address_checkbox

 /**
  * 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');
     }
 }
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:29,代码来源:class-wc-subscriptions-addresses.php


注:本文中的woocommerce_form_field函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。