public function admin_coupon_options_extended_features() { //============================= //Title echo "<h3 style='display:inline'>" . esc_html(__('Auto coupon', 'woocommerce-jos-autocoupon')) . "</h3>\n"; //============================= // Auto coupon checkbox woocommerce_wp_checkbox(array('id' => '_wjecf_is_auto_coupon', 'label' => __('Auto coupon', 'woocommerce-jos-autocoupon'), 'description' => __("Automatically add the coupon to the cart if the restrictions are met. Please enter a description when you check this box, the description will be shown in the customer's cart if the coupon is applied.", 'woocommerce-jos-autocoupon'))); //============================= // Apply without notice woocommerce_wp_checkbox(array('id' => '_wjecf_apply_silently', 'label' => __('Apply silently', 'woocommerce-jos-autocoupon'), 'description' => __("Don't display a message when this coupon is automatically applied.", 'woocommerce-jos-autocoupon'))); ?> <script type="text/javascript"> //Hide/show when AUTO-COUPON value changes function update_wjecf_apply_silently_field( animation ) { if ( animation === undefined ) animation = 'slow'; if (jQuery("#_wjecf_is_auto_coupon").prop('checked')) { jQuery("._wjecf_apply_silently_field").show( animation ); } else { jQuery("._wjecf_apply_silently_field").hide( animation ); } } update_wjecf_apply_silently_field( 0 ); jQuery("#_wjecf_is_auto_coupon").click( update_wjecf_apply_silently_field ); </script> <?php }
/** * Adds the option to set the product as coming soon for single products. * * @since 1.0.0 * @access public * @uses woocommerce_wp_checkbox() * @uses woocommerce_wp_text_input() */ function ss_wc_write_coming_soon_tab_panel() { echo '<div class="options_group">'; woocommerce_wp_checkbox(array('id' => '_set_coming_soon', 'label' => __('Set for Coming Soon?', 'ss-wc-coming-soon'), 'desc_tip' => true, 'description' => __('Make sure that you have set the stock to "Out of Stock".', 'ss-wc-coming-soon'), 'wrapper_class' => 'hide_if_variable')); woocommerce_wp_text_input(array('id' => '_coming_soon_label', 'label' => __('Coming Soon Label', 'ss-wc-coming-soon'), 'placeholder' => __('Coming Soon', 'ss-wc-coming-soon'), 'desc_tip' => true, 'description' => __('Enter the label you want to show if coming soon is set. Default: Coming Soon', 'ss-wc-coming-soon'), 'wrapper_class' => 'hide_if_variable')); echo '</div>'; }
public static function output_shipping() { global $post, $thepostid; if (version_compare(WC()->version, '2.3', '<')) { return; } $thepostid = $post->ID; $_product = wc_get_product($thepostid); $delivery_time = $_product->gzd_product->delivery_time; ?> <p class="form-field"> <label for="delivery_time"><?php _e('Delivery Time', 'woocommerce-germanized'); ?> </label> <input type="hidden" class="wc-product-search wc-gzd-delivery-time-search" style="width: 50%" id="delivery_time" name="delivery_time" data-minimum_input_length="1" data-allow_clear="true" data-placeholder="<?php _e('Search for a delivery time…', 'woocommerce-germanized'); ?> " data-action="woocommerce_gzd_json_search_delivery_time" data-multiple="false" data-selected="<?php echo $delivery_time ? $delivery_time->name : ''; ?> " value="<?php echo $delivery_time ? $delivery_time->term_id : ''; ?> " /> </p> <?php // Free shipping woocommerce_wp_checkbox(array('id' => '_free_shipping', 'label' => __('Free shipping?', 'woocommerce-germanized'), 'description' => __('This option disables the "plus shipping costs" notice on product page', 'woocommerce-germanized'))); }
/** * Display the custom WCRC fields on every product edit page */ function woo_refercheck_add_custom_general_fields() { global $woocommerce, $post; // read the current referrers list $referrers = get_post_meta($post->ID, '_woo_refercheck_referrers', true); // convert to array $ref_array = json_decode($referrers); // build the value of the textarea $theval = ''; if (count($ref_array) > 0) { $i = 0; foreach ($ref_array as $item) { $theval .= $item; if ($i != count($ref_array) - 1) { $theval .= PHP_EOL; } $i++; } } // start the HTML output for the custom fields echo '<div class="options_group">'; // create and output the checkbox woocommerce_wp_checkbox(array('id' => '_woo_refercheck_checkbox', 'label' => __('Limit to referrer(s)', 'woo-refercheck'), 'description' => __('Select if the display of this product should be limited to the specified referrer(s).', 'woo-refercheck'))); // create and output the text field woocommerce_wp_textarea_input(array('id' => '_woo_refercheck_referrers', 'label' => __('Allowed referrer(s)', 'woo-refercheck'), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Add the full HTTP addresseses of allowed referrer(s) for this product, one per line.', 'woo-refercheck'), 'value' => $theval)); woocommerce_wp_text_input(array('id' => '_woo_refercheck_target', 'label' => __('Redirect to', 'woo-refercheck'), 'placeholder' => 'http://', 'desc_tip' => 'true', 'description' => __('Enter the absolute URL to redirect to when this product is accessed form an unallowed referer.', 'woo-refercheck'))); // complete the HTML output echo '</div>'; }
/** * Adds the custom fields * * @access public * @return void */ function discontinued_product_for_woocommerce_add_custom_fields() { global $woocommerce, $post; echo '<div class="options_group">'; woocommerce_wp_checkbox(array('id' => '_discontinued', 'label' => __('Discontinued', 'discontinued_product_for_woocommerce'), 'name' => '_discontinued', 'description' => __('Check this box to mark this product as discontinued.', 'discontinued_product_for_woocommerce'))); echo '</div>'; }
public function add_product_fields() { global $woocommerce, $post; echo '<div class="options_group show_if_variable">'; woocommerce_wp_checkbox(array('id' => '_dh_disable_variation_gallery', 'label' => __('Disable Variation Gallery ?', 'sitesao'))); echo '</div>'; }
/** * Displays the fields for the new tab panel. * * @since 0.0.1 * @access public * @uses woocommerce_wp_checkbox() * @uses woocommerce_wp_text_input() * @uses woocommerce_wp_select() * @uses ss_wc_wp_select() */ function ss_wc_write_digital_details_tab_panel() { echo '<div id="digital_details_product_data" class="panel woocommerce_options_panel">'; do_action('ss_wc_digital_details_options_top'); echo '<div class="options_group">'; // What licence woocommerce_wp_text_input(array('id' => '_licence', 'label' => __('Licence', 'ss-wc-digital-details'), 'desc_tip' => true, 'description' => __('Enter the licence that is associated with this file.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable', 'style' => 'width: 300px;')); // File Size woocommerce_wp_text_input(array('id' => '_file_size', 'label' => __('File Size', 'ss-wc-digital-details'), 'desc_tip' => true, 'description' => __('Enter the size of the file. e.g. 1 KB, 1 MB or 1 GB', 'ss-wc-digital-details'), 'placeholder' => __('1.5 MB', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable', 'style' => 'width: 150px;')); echo '</div>'; echo '<div class="options_group">'; // Is Web Font? woocommerce_wp_checkbox(array('id' => '_is_web_font', 'label' => __('Web Font?', 'ss-wc-digital-details'), 'description' => __('Enable if this file is a Web Font.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); echo '</div>'; echo '<div class="options_group">'; // Is Tileable? woocommerce_wp_checkbox(array('id' => '_is_tileable', 'label' => __('Tileable?', 'ss-wc-digital-details'), 'description' => __('Enable if this file is Tileable.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Is Layered? woocommerce_wp_checkbox(array('id' => '_is_layered', 'label' => __('Layered?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has Layers.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Is Vector? woocommerce_wp_checkbox(array('id' => '_is_vector', 'label' => __('Vector Formatted?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has a Vector format.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); echo '</div>'; echo '<div class="options_group">'; // Is Fluid Layout? woocommerce_wp_checkbox(array('id' => '_is_fluid_layout', 'label' => __('Fluid Layout?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has a fluid layout.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Is Fixed Layout? woocommerce_wp_checkbox(array('id' => '_is_fixed_layout', 'label' => __('Fixed Layout?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has a fixed layout.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Is Responsive Layout? woocommerce_wp_checkbox(array('id' => '_is_responsive_layout', 'label' => __('Responsive Layout?', 'ss-wc-digital-details'), 'description' => __('Enable if this file has a responsive layout.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Columns woocommerce_wp_text_input(array('id' => '_columns', 'label' => __('Columns', 'ss-wc-digital-details'), 'placeholder' => '12', 'desc_tip' => true, 'description' => __('Enter the amount of columns this theme has.', 'ss-wc-digital-details'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '1'), 'wrapper_class' => 'hide_if_variable', 'style' => 'width: 60px;')); // Minimum Browser Requirement // @filter ss_wc_digital_details_min_browser_options ss_wc_wp_select(array('id' => '_minimum_browser_requirement', 'label' => __('Minimum Browser', 'ss-wc-digital-details'), 'type' => 'multiselect', 'options' => apply_filters('ss_wc_digital_details_min_browser_options', array('' => '', 'ie9' => __('IE 9+', 'ss-wc-digital-details'), 'firefox_14' => __('Firefox 14+', 'ss-wc-digital-details'), 'chrome_19' => __('Chrome 19+', 'ss-wc-digital-details'), 'safari_5' => __('Safari 5.1+', 'ss-wc-digital-details'), 'opera_12' => __('Opera 12+', 'ss-wc-digital-details'))), 'default' => '', 'wrapper_class' => 'hide_if_variable', 'placeholder' => __('Select the browsers this theme works in.', 'ss-wc-digital-details'), 'class' => 'wc-enhanced-select chosen_select', 'style' => 'min-width: 350px;')); echo '</div>'; echo '<div class="options_group">'; // Dimensions woocommerce_wp_textarea_input(array('id' => '_dimensions', 'label' => __('Dimensions', 'ss-wc-digital-details'), 'placeholder' => sprintf(__('Enter the dimensions of the digital item by "%s" seperating the values.', 'ss-wc-digital-details'), WC_DELIMITER), 'desc_tip' => true, 'description' => __('e.g. 8.5 x 11 in', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); // Orientation ss_wc_wp_select(array('id' => '_orientation', 'label' => __('Orientation', 'ss-wc-digital-details'), 'options' => array('' => '', 'landscape' => __('Landscape', 'ss-wc-digital-details'), 'portrait' => __('Portrait', 'ss-wc-digital-details'), 'square' => __('Square', 'ss-wc-digital-details')), 'default' => '', 'wrapper_class' => 'show_if_photo', 'placeholder' => __('Select the orientation of this photo.', 'ss-wc-digital-details'), 'class' => 'wc-enhanced-select chosen_select', 'style' => 'width: 300px;')); // DPI Size woocommerce_wp_text_input(array('id' => '_dpi_size', 'label' => __('DPI Size', 'ss-wc-digital-details'), 'placeholder' => '72', 'desc_tip' => true, 'description' => __('Enter the DPI size of the file.', 'ss-wc-digital-details'), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '72'), 'wrapper_class' => 'hide_if_variable', 'style' => 'width: 60px;')); echo '</div>'; echo '<div class="options_group">'; // Requirements // @filter ss_wc_digital_details_requirement_options ss_wc_wp_select(array('id' => '_requirements', 'label' => __('Requirements', 'ss-wc-digital-details'), 'type' => 'multiselect', 'options' => apply_filters('ss_wc_digital_details_requirement_options', array('' => '', 'adobe_cs1+' => 'Adobe CS1+', 'adobe_cs2+' => 'Adobe CS2+', 'adobe_cs3+' => 'Adobe CS3+', 'adobe_cs4+' => 'Adobe CS4+', 'adobe_cs5+' => 'Adobe CS5+', 'adobe_photoshop' => 'Adobe Photoshop', 'adobe_indesign' => 'Adobe InDesign', 'adobe_illustrator' => 'Adobe Illustrator', 'adobe_after_effcts' => 'Adobe After Effects')), 'default' => '', 'wrapper_class' => 'hide_if_variable', 'placeholder' => __('Select the requirements this file needs to edit', 'ss-wc-digital-details'), 'class' => 'wc-enhanced-select chosen_select', 'style' => 'min-width: 350px;')); // Live Preview woocommerce_wp_text_input(array('id' => '_live_preview', 'label' => __('Live Preview', 'ss-wc-digital-details'), 'placeholder' => 'http://', 'desc_tip' => true, 'description' => __('Enter the URL address for the live preview of this item.', 'ss-wc-digital-details'), 'data_type' => 'url', 'wrapper_class' => 'hide_if_variable', 'style' => 'min-width: 350px;')); echo '</div>'; echo '<div class="options_group">'; // Message to Customers woocommerce_wp_textarea_input(array('id' => '_message_to_customers', 'label' => __('Message to Customers', 'ss-wc-digital-details'), 'desc_tip' => true, 'description' => __('Leave a message for your customers. This will be displayed under the featured image.', 'ss-wc-digital-details'), 'wrapper_class' => 'hide_if_variable')); echo '</div>'; // Close group do_action('ss_wc_digital_details_options_bottom'); echo '</div>'; // Close product tab panel }
public function wc_ebs_add_product_option_pricing() { global $woocommerce, $post; echo '<div class="options_group">'; // Checkbox woocommerce_wp_checkbox(array('id' => '_booking_option', 'class' => 'wc_booking_option checkbox', 'wrapper_class' => 'show_if_simple', 'label' => __('Add booking option', 'wc_ebs'))); echo '</div>'; }
function fbc_wc_tab_options() { global $post; $fbc_wc_tab_options = array('title' => get_post_meta($post->ID, 'fbc_wc_tab_title', true), 'count' => get_post_meta($post->ID, 'fbc_wc_tab_count', true)); ?> <div id="fbc_wc_tab_option" class="panel woocommerce_options_panel"> <div class="options_group"> <p class="form-field"> <?php woocommerce_wp_checkbox(array('id' => 'fbc_wc_tab_enabled', 'label' => __('Enable Facebook Comment Tab?', 'woocommerce'), 'description' => __('Enable this option to enable the facebook comment widget tab on the frontend.', 'woocommerce'))); ?> </p> <?php if (get_option('fbc_share_enabled') != 'yes') { ?> <p class="form-field"> <?php woocommerce_wp_checkbox(array('id' => 'fbc_wc_soc_share', 'label' => __('Enable Social Share?', 'woocommerce'), 'description' => __('Enable this option to enable the shocial share on the frontend.', 'woocommerce'))); ?> </p> <?php } ?> </div> <div class="options_group fbc_wc_tab_option"> <p class="form-field"> <label for="fbc_wc_tab_title"><?php _e('FB Comment Title:', 'woocommerce'); ?> </label> <input type="text" size="5" name="fbc_wc_tab_title" id="fbc_wc_tab_title" value="<?php echo @$fbc_wc_tab_options['title']; ?> " placeholder="<?php _e('Enter your FB Comment tab title', 'woocommerce'); ?> " /> </p> <p class="form-field"> <label for="fbc_wc_tab_count"><?php _e('Comment Count:', 'woocommerce'); ?> </label> <input type="text" size="3" name="fbc_wc_tab_count" id="fbc_wc_tab_count" value="<?php echo @$fbc_wc_tab_options['count']; ?> " placeholder="<?php _e('How much comment will be shown', 'woocommerce'); ?> " /> </p> </div> </div> <?php }
function wsbs_calculator_tab_options() { global $post, $woocommerce, $product; // Start a container echo "<div id=\"calculator_tab_data\" class=\"panel woocommerce_options_panel\">"; // Boolean calculator woocommerce_wp_checkbox(array('id' => '_calculatorscript_active', 'label' => __('Enable Calculator', 'wsbs'), 'value' => esc_attr($post->_calculatorscript_active))); // Calculator value woocommerce_wp_text_input(array('id' => '_calculatorscript_value', 'label' => __('Calculator value', 'wsbs'), 'description' => __('This package contains ... m<sup>2</sup> (e.g. 1.5)', 'woocommerce'), 'value' => $post->_calculatorscript_value)); // Close the container echo "</div>"; }
public function points_add_custom_settings() { global $woocommerce, $post; echo '<div class="options_group show-if-points">'; // Commission Price pulled from WooCommerce Core woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Commission Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price')); // Create a number field, for example for UPC woocommerce_wp_text_input(array('id' => 'points_product_cost', 'label' => __('Points Cost', 'woocommerce'), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __('Enter the amount of points this product costs.', 'woocommerce'), 'type' => 'number')); // Individual product woocommerce_wp_checkbox(array('id' => '_sold_individually', 'label' => __('Sold Individually', 'woocommerce'), 'description' => __('Enable this to only allow one of this item to be bought in a single order', 'woocommerce'))); echo '</div>'; }
public function add_to_metabox() { global $post; echo '<div class="options_group">'; // Checkbox woocommerce_wp_checkbox(array('id' => '_wc_extension_boilerplate_checkbox', 'wrapper_class' => 'show_if_simple', 'label' => __('Sample Checkbox', 'woocommerce-extension-boilerplate'), 'description' => __('This is a sample checkbox.', 'woocommerce-extension-boilerplate'))); // Number woocommerce_wp_text_input(array('id' => '_wc_extension_boilerplate_number', 'class' => 'show_if_simple', 'label' => __('Sample Number Field', 'woocommerce-extension-boilerplate'), 'desc_tip' => 'true', 'description' => __('This is a sample number field', 'woocommerce-extension-boilerplate'), 'type' => 'decimal')); // Text woocommerce_wp_text_input(array('id' => '_wc_extension_boilerplate_textbox', 'class' => 'show_if_simple', 'label' => __('Sample Text Field', 'woocommerce-extension-boilerplate'), 'desc_tip' => 'true', 'description' => __('This is a sample text field', 'woocommerce-extension-boilerplate'))); do_action('wc_extension_boilerplate_product_options'); echo '</div>'; }
/** * Prints the daily coupons checkboxes */ public function add_daily_coupons_fields() { global $post; $rawValues = get_post_meta($post->ID, 'daily_coupon', true); $values = empty($rawValues) ? array() : explode(',', $rawValues); $days = array('Monday', 'Tuesday', 'Wednesday', 'Thusday', 'Friday', 'Saturday', 'Sunday'); echo '<h3>' . __('Only allow this coupon to be used on the following days:', $this->plugin_name) . '</h3>'; echo '<p><i>If left blank, the coupon will work as normal.</i></p>'; foreach ($days as $day) { $minDay = substr($day, 0, 3); woocommerce_wp_checkbox(array('id' => 'daily_coupon_' . $day, 'label' => __($day, $this->plugin_name), 'name' => __('daily_coupon[]', $this->plugin_name), 'cbvalue' => $minDay, 'value' => in_array($minDay, $values) ? $minDay : '')); } }
/** * Contents of the rental options product tab. */ function rental_options_product_tab_content() { global $post; ?> <div id='rental_options' class='panel woocommerce_options_panel'><?php ?> <div class='options_group'><?php woocommerce_wp_checkbox(array('id' => '_enable_renta_option', 'label' => __('Enable rental option X', 'woocommerce'))); woocommerce_wp_text_input(array('id' => '_text_input_y', 'label' => __('What is the value of Y', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('A handy description field', 'woocommerce'), 'type' => 'text')); print_r(wc_get_product($post)); ?> </div> </div><?php }
public function product_settings_fields() { global $woocommerce, $post; echo '<div id="fees_product_data" class="fee_panel panel woocommerce_options_panel wc-metaboxes-wrapper">'; echo '<div class="options_group">'; // Text Field - Fee Name woocommerce_wp_text_input(array('id' => 'product-fee-name', 'label' => __('Fee Name', 'woocommerce-product-fees'), 'data_type' => 'text', 'placeholder' => __('Product Fee', 'placeholder', 'woocommerce-product-fees'), 'desc_tip' => 'true', 'description' => __('This will be shown at checkout descriping the added fee.', 'woocommerce-product-fees'))); // Text Field - Fee Amount woocommerce_wp_text_input(array('id' => 'product-fee-amount', 'label' => __('Fee Amount', 'woocommerce-product-fees') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price', 'desc_tip' => 'true', 'description' => __('Enter a monetary decimal without any currency symbols or thousand seperators. This field also accepts percentages.', 'woocommerce-product-fees'))); echo '</div>'; echo '<div class="options_group">'; // Check Box - Fee Multiply Option woocommerce_wp_checkbox(array('id' => 'product-fee-multiplier', 'label' => __('Multiply Fee by Quantity', 'woocommerce-product-fees'), 'desc_tip' => 'true', 'description' => __('Multiply the fee by the quanitity of this product that is added to the cart.', 'woocommerce-product-fees'))); echo '</div>'; echo '</div>'; }
public function variation_settings_fields($loop, $variation_data, $variation) { // Set placeholders based on global product level fees. $parent_id = $variation->post_parent; if (get_post_meta($parent_id, 'product-fee-name', true) != '' && get_post_meta($parent_id, 'product-fee-amount', true) != '') { $placeholders = array('name' => get_post_meta($parent_id, 'product-fee-name', true), 'amount' => get_post_meta($parent_id, 'product-fee-amount', true)); } else { $placeholders = array('name' => __('Product Fee', 'woocommerce-product-fees'), 'amount' => __('Monetary Decimal or Percentage', 'woocommerce-product-fees')); } // Text Field - Fee Name woocommerce_wp_text_input(array('id' => 'product-fee-name[' . $variation->ID . ']', 'label' => __('Fee Name', 'woocommerce-product-fees'), 'data_type' => 'text', 'placeholder' => $placeholders['name'], 'value' => get_post_meta($variation->ID, 'product-fee-name', true), 'wrapper_class' => "form-row form-row-first")); // Text Field - Fee Amount woocommerce_wp_text_input(array('id' => 'product-fee-amount[' . $variation->ID . ']', 'label' => __('Fee Amount', 'woocommerce-product-fees') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price', 'placeholder' => $placeholders['amount'], 'value' => get_post_meta($variation->ID, 'product-fee-amount', true), 'wrapper_class' => "form-row form-row-last")); // Check Box - Fee Multiply Option woocommerce_wp_checkbox(array('id' => 'product-fee-multiplier[' . $variation->ID . ']', 'label' => __('Multiply Fee by Quantity', 'woocommerce-product-fees'), 'value' => get_post_meta($variation->ID, 'product-fee-multiplier', true), 'wrapper_class' => "product-fee-multiplier")); do_action('wcpf_add_variation_settings'); }
/** * Output Meta Box * * The function to be called to output the meta box in product details page. * * @param $post object the current product * @since 1.0.0 * @author Alberto Ruggiero * @return void */ public static function output($post) { wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce'); $args = array('add_to_cart' => array('id' => '_ywctm_exclude_catalog_mode', 'wrapper_class' => '', 'label' => __('"Add to cart" button', 'ywctm'), 'description' => 'Exclude this product from hiding "Add to cart" button'), 'price' => array('id' => '_ywctm_exclude_hide_price', 'wrapper_class' => '', 'label' => __('Product price', 'ywctm'), 'description' => 'Exclude this product from hiding price')); ?> <div class="panel woocommerce_options_panel"> <div class="options_group"> <?php woocommerce_wp_checkbox($args['add_to_cart']); ?> <?php woocommerce_wp_checkbox($args['price']); ?> </div> </div> <?php }
public function product_settings_fields() { global $woocommerce, $post; echo '<div id="fees_product_data" class="fee_panel panel woocommerce_options_panel wc-metaboxes-wrapper">'; echo '<div class="options_group">'; // Text Field - Fee Name woocommerce_wp_text_input(array('id' => 'product-fee-name', 'label' => __('Fee Name', 'woocommerce-product-fees'), 'data_type' => 'text', 'placeholder' => __('Product Fee', 'placeholder', 'woocommerce-product-fees'), 'desc_tip' => 'true', 'description' => __('This will be shown at checkout descriping the added fee.', 'woocommerce-product-fees'))); // Load product's base currency. It will be used to show the Admin which // fees can be calculated automatically $product_base_currency = WooCommerce_Product_Fees_Currency_Helper::get_product_base_currency($post->ID); // Get a list of the enabled currencies. We will need to display one price // field for each. By using the merge/unique trick, we can make sure that // product's base currency is always the first in the list (the enabled_currencies() // method returns them sorted alphabetically) $enabled_currencies = array_unique(array_merge(array($product_base_currency), WooCommerce_Product_Fees_Currency_Helper::enabled_currencies())); $placeholder = ''; foreach ($enabled_currencies as $currency) { $field_description = __('Enter a monetary decimal without any currency symbols or thousand separators. This field also accepts percentages.', 'woocommerce-product-fees'); // For additional currencies, add an extra description to explain that the // fees can be calculated automatically if ($currency != $product_base_currency) { $field_description = ' ' . sprintf(__('If you leave this field empty, its value will be calculated automatically, by converting the base amount in %s to this currency.', 'woocommerce-product-fees'), $product_base_currency); } // If we have more than one currency, show a different placeholder for // the base currency and the additional ones, to help the admin to understand // which ones can be calculated automatically. When a single currency is // used, the placeholder can be left empty, as the field's purpose is // obvious if (count($enabled_currencies) > 1) { $placeholder = $currency === $product_base_currency ? __('Base amount', 'woocommerce-product-fees') : __('Auto', 'woocommerce-product-fees'); } // Text Field - Fee Amount woocommerce_wp_text_input(array('id' => 'product-fee-amount-' . $currency, 'label' => __('Fee Amount', 'woocommerce-product-fees') . ' (' . $currency . ')', 'data_type' => 'price', 'desc_tip' => 'true', 'description' => $field_description, 'name' => 'product-fee-amount[' . $currency . ']', 'placeholder' => $placeholder)); } echo '</div>'; echo '<div class="options_group">'; // Check Box - Fee Multiply Option woocommerce_wp_checkbox(array('id' => 'product-fee-multiplier', 'label' => __('Multiply Fee by Quantity', 'woocommerce-product-fees'), 'desc_tip' => 'true', 'description' => __('Multiply the fee by the quanitity of this product that is added to the cart.', 'woocommerce-product-fees'))); echo '</div>'; echo '</div>'; }
/** * Display product settings * * @access public * @since 2.2 */ public function data_display() { ?> <div id="rcp_access_control" class="panel woocommerce_options_panel"> <div class="options_group"> <p><?php _e('Restrict purchasing of this product to:', 'rcp'); ?> </p> <?php woocommerce_wp_checkbox(array('id' => '_rcp_woo_active_to_purchase', 'label' => __('Active subscribers only?', 'rcp'), 'cbvalue' => 1)); $levels = (array) get_post_meta(get_the_ID(), '_rcp_woo_subscription_levels_to_purchase', true); foreach (rcp_get_subscription_levels('all') as $level) { woocommerce_wp_checkbox(array('name' => '_rcp_woo_subscription_levels_to_purchase[]', 'id' => '_rcp_woo_subscription_level_' . $level->id, 'label' => $level->name, 'value' => in_array($level->id, $levels) ? $level->id : 0, 'cbvalue' => $level->id)); } woocommerce_wp_select(array('id' => '_rcp_woo_access_level_to_purchase', 'label' => __('Access level required?', 'rcp'), 'options' => rcp_get_access_levels())); ?> </div> <div class="options_group"> <p><?php _e('Restrict viewing of this product to:', 'rcp'); ?> </p> <?php woocommerce_wp_checkbox(array('id' => '_rcp_woo_active_to_view', 'label' => __('Active subscribers only?', 'rcp'), 'cbvalue' => 1)); $levels = (array) get_post_meta(get_the_ID(), '_rcp_woo_subscription_levels_to_view', true); foreach (rcp_get_subscription_levels('all') as $level) { woocommerce_wp_checkbox(array('name' => '_rcp_woo_subscription_levels_to_view[]', 'id' => '_rcp_woo_subscription_level_to_view_' . $level->id, 'label' => $level->name, 'value' => in_array($level->id, $levels) ? $level->id : 0, 'cbvalue' => $level->id)); } woocommerce_wp_select(array('id' => '_rcp_woo_access_level_to_view', 'label' => __('Access level required?', 'rcp'), 'options' => rcp_get_access_levels())); ?> </div> </div> <?php }
public static function add_to_metabox() { global $post; echo '<div class="options_group show_if_nyp">'; if (class_exists('WC_Subscriptions')) { // make billing period variable woocommerce_wp_checkbox(array('id' => '_variable_billing', 'wrapper_class' => 'show_if_subscription', 'label' => __('Variable Billing Period', 'wc_name_your_price'), 'description' => __('Allow the customer to set the billing period.', 'wc_name_your_price'))); } // Suggested Price woocommerce_wp_text_input(array('id' => '_suggested_price', 'class' => 'wc_input_price short', 'label' => __('Suggested Price', 'wc_name_your_price') . ' (' . get_woocommerce_currency_symbol() . ')', 'desc_tip' => 'true', 'description' => __('Price to pre-fill for customers. Leave blank to not suggest a price.', 'wc_name_your_price'), 'data_type' => 'price')); if (class_exists('WC_Subscriptions')) { // Suggested Billing Period woocommerce_wp_select(array('id' => '_suggested_billing_period', 'label' => __('per', 'wc_name_your_price'), 'options' => WC_Name_Your_Price_Helpers::get_subscription_period_strings())); } // Minimum Price woocommerce_wp_text_input(array('id' => '_min_price', 'class' => 'wc_input_price short', 'label' => __('Minimum Price', 'wc_name_your_price') . ' (' . get_woocommerce_currency_symbol() . ')', 'desc_tip' => 'true', 'description' => __('Lowest acceptable price for product. Leave blank to not enforce a minimum. Must be less than or equal to the set suggested price.', 'wc_name_your_price'), 'data_type' => 'price')); if (class_exists('WC_Subscriptions')) { // Minimum Billing Period woocommerce_wp_select(array('id' => '_minimum_billing_period', 'label' => __('per', 'wc_name_your_price'), 'options' => WC_Name_Your_Price_Helpers::get_subscription_period_strings())); } do_action('woocommerce_name_your_price_options_pricing'); echo '</div>'; }
/** * Output the metabox */ public static function output($post) { global $post, $thepostid; wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce'); $thepostid = $post->ID; if ($terms = wp_get_object_terms($post->ID, 'product_type')) { $product_type = sanitize_title(current($terms)->name); } else { $product_type = apply_filters('default_product_type', 'simple'); } $product_type_selector = apply_filters('product_type_selector', array('simple' => __('Simple product', 'woocommerce'), 'grouped' => __('Grouped product', 'woocommerce'), 'external' => __('External/Affiliate product', 'woocommerce'), 'variable' => __('Variable product', 'woocommerce')), $product_type); $type_box = '<label for="product-type"><select id="product-type" name="product-type"><optgroup label="' . __('Product Type', 'woocommerce') . '">'; foreach ($product_type_selector as $value => $label) { $type_box .= '<option value="' . esc_attr($value) . '" ' . selected($product_type, $value, false) . '>' . esc_html($label) . '</option>'; } $type_box .= '</optgroup></select></label>'; $product_type_options = apply_filters('product_type_options', array('virtual' => array('id' => '_virtual', 'wrapper_class' => 'show_if_simple', 'label' => __('Virtual', 'woocommerce'), 'description' => __('Virtual products are intangible and aren\'t shipped.', 'woocommerce'), 'default' => 'no'), 'downloadable' => array('id' => '_downloadable', 'wrapper_class' => 'show_if_simple', 'label' => __('Downloadable', 'woocommerce'), 'description' => __('Downloadable products give access to a file upon purchase.', 'woocommerce'), 'default' => 'no'))); foreach ($product_type_options as $key => $option) { $selected_value = get_post_meta($post->ID, '_' . $key, true); if ('' == $selected_value && isset($option['default'])) { $selected_value = $option['default']; } $type_box .= '<label for="' . esc_attr($option['id']) . '" class="' . esc_attr($option['wrapper_class']) . ' tips" data-tip="' . esc_attr($option['description']) . '">' . esc_html($option['label']) . ': <input type="checkbox" name="' . esc_attr($option['id']) . '" id="' . esc_attr($option['id']) . '" ' . checked($selected_value, 'yes', false) . ' /></label>'; } ?> <div class="panel-wrap product_data"> <span class="type_box"> — <?php echo $type_box; ?> </span> <ul class="product_data_tabs wc-tabs" style="display:none;"> <?php $product_data_tabs = apply_filters('woocommerce_product_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_product_data', 'class' => array('hide_if_grouped')), 'inventory' => array('label' => __('Inventory', 'woocommerce'), 'target' => 'inventory_product_data', 'class' => array('show_if_simple', 'show_if_variable', 'show_if_grouped')), 'shipping' => array('label' => __('Shipping', 'woocommerce'), 'target' => 'shipping_product_data', 'class' => array('hide_if_virtual', 'hide_if_grouped', 'hide_if_external')), 'linked_product' => array('label' => __('Linked Products', 'woocommerce'), 'target' => 'linked_product_data', 'class' => array()), 'attribute' => array('label' => __('Attributes', 'woocommerce'), 'target' => 'product_attributes', 'class' => array()), 'variations' => array('label' => __('Variations', 'woocommerce'), 'target' => 'variable_product_options', 'class' => array('variations_tab', 'show_if_variable')), 'advanced' => array('label' => __('Advanced', 'woocommerce'), 'target' => 'advanced_product_data', 'class' => array()))); foreach ($product_data_tabs as $key => $tab) { ?> <li class="<?php echo $key; ?> _options <?php echo $key; ?> _tab <?php echo implode(' ', $tab['class']); ?> "> <a href="#<?php echo $tab['target']; ?> "><?php echo esc_html($tab['label']); ?> </a> </li><?php } do_action('woocommerce_product_write_panel_tabs'); ?> </ul> <div id="general_product_data" class="panel woocommerce_options_panel"><?php echo '<div class="options_group hide_if_grouped">'; // SKU if (wc_product_sku_enabled()) { woocommerce_wp_text_input(array('id' => '_sku', 'label' => '<abbr title="' . __('Stock Keeping Unit', 'woocommerce') . '">' . __('SKU', 'woocommerce') . '</abbr>', 'desc_tip' => 'true', 'description' => __('SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce'))); } else { echo '<input type="hidden" name="_sku" value="' . esc_attr(get_post_meta($thepostid, '_sku', true)) . '" />'; } do_action('woocommerce_product_options_sku'); echo '</div>'; echo '<div class="options_group show_if_external">'; // External URL woocommerce_wp_text_input(array('id' => '_product_url', 'label' => __('Product URL', 'woocommerce'), 'placeholder' => 'http://', 'description' => __('Enter the external URL to the product.', 'woocommerce'))); // Button text woocommerce_wp_text_input(array('id' => '_button_text', 'label' => __('Button text', 'woocommerce'), 'placeholder' => _x('Buy product', 'placeholder', 'woocommerce'), 'description' => __('This text will be shown on the button linking to the external product.', 'woocommerce'))); echo '</div>'; echo '<div class="options_group pricing show_if_simple show_if_external">'; // Price woocommerce_wp_text_input(array('id' => '_regular_price', 'label' => __('Regular Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price')); // Special Price woocommerce_wp_text_input(array('id' => '_sale_price', 'data_type' => 'price', 'label' => __('Sale Price', 'woocommerce') . ' (' . get_woocommerce_currency_symbol() . ')', 'description' => '<a href="#" class="sale_schedule">' . __('Schedule', 'woocommerce') . '</a>')); // Special Price date range $sale_price_dates_from = ($date = get_post_meta($thepostid, '_sale_price_dates_from', true)) ? date_i18n('Y-m-d', $date) : ''; $sale_price_dates_to = ($date = get_post_meta($thepostid, '_sale_price_dates_to', true)) ? date_i18n('Y-m-d', $date) : ''; echo '<p class="form-field sale_price_dates_fields"> <label for="_sale_price_dates_from">' . __('Sale Price Dates', 'woocommerce') . '</label> <input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr($sale_price_dates_from) . '" placeholder="' . _x('From…', 'placeholder', 'woocommerce') . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> <input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr($sale_price_dates_to) . '" placeholder="' . _x('To…', 'placeholder', 'woocommerce') . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> <a href="#" class="cancel_sale_schedule">' . __('Cancel', 'woocommerce') . '</a> <img class="help_tip" style="margin-top: 21px;" data-tip="' . __('The sale will end at the beginning of the set date.', 'woocommerce') . '" src="' . esc_url(WC()->plugin_url()) . '/assets/images/help.png" height="16" width="16" /> </p>'; do_action('woocommerce_product_options_pricing'); echo '</div>'; echo '<div class="options_group show_if_downloadable">'; ?> <div class="form-field downloadable_files"> <label><?php _e('Downloadable Files', 'woocommerce'); ?> :</label> <table class="widefat"> <thead> <tr> <th class="sort"> </th> <th><?php _e('Name', 'woocommerce'); ?> <span class="tips" data-tip="<?php _e('This is the name of the download shown to the customer.', 'woocommerce'); ?> ">[?]</span></th> <th colspan="2"><?php _e('File URL', 'woocommerce'); ?> <span class="tips" data-tip="<?php _e('This is the URL or absolute path to the file which customers will get access to. URLs entered here should already be encoded.', 'woocommerce'); ?> ">[?]</span></th> <th> </th> </tr> </thead> <tbody> <?php $downloadable_files = get_post_meta($post->ID, '_downloadable_files', true); if ($downloadable_files) { foreach ($downloadable_files as $key => $file) { include 'views/html-product-download.php'; } } ?> </tbody> <tfoot> <tr> <th colspan="5"> <a href="#" class="button insert" data-row="<?php $file = array('file' => '', 'name' => ''); ob_start(); include 'views/html-product-download.php'; echo esc_attr(ob_get_clean()); ?> "><?php _e('Add File', 'woocommerce'); ?> </a> </th> </tr> </tfoot> </table> </div> <?php // Download Limit woocommerce_wp_text_input(array('id' => '_download_limit', 'label' => __('Download Limit', 'woocommerce'), 'placeholder' => __('Unlimited', 'woocommerce'), 'description' => __('Leave blank for unlimited re-downloads.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0'))); // Expirey woocommerce_wp_text_input(array('id' => '_download_expiry', 'label' => __('Download Expiry', 'woocommerce'), 'placeholder' => __('Never', 'woocommerce'), 'description' => __('Enter the number of days before a download link expires, or leave blank.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '0'))); // Download Type woocommerce_wp_select(array('id' => '_download_type', 'label' => __('Download Type', 'woocommerce'), 'description' => sprintf(__('Choose a download type - this controls the <a href="%s">schema</a>.', 'woocommerce'), 'http://schema.org/'), 'options' => array('' => __('Standard Product', 'woocommerce'), 'application' => __('Application/Software', 'woocommerce'), 'music' => __('Music', 'woocommerce')))); do_action('woocommerce_product_options_downloads'); echo '</div>'; if (wc_tax_enabled()) { echo '<div class="options_group show_if_simple show_if_external show_if_variable">'; // Tax woocommerce_wp_select(array('id' => '_tax_status', 'label' => __('Tax Status', 'woocommerce'), 'options' => array('taxable' => __('Taxable', 'woocommerce'), 'shipping' => __('Shipping only', 'woocommerce'), 'none' => _x('None', 'Tax status', 'woocommerce')))); $tax_classes = WC_Tax::get_tax_classes(); $classes_options = array(); $classes_options[''] = __('Standard', 'woocommerce'); if (!empty($tax_classes)) { foreach ($tax_classes as $class) { $classes_options[sanitize_title($class)] = esc_html($class); } } woocommerce_wp_select(array('id' => '_tax_class', 'label' => __('Tax Class', 'woocommerce'), 'options' => $classes_options)); do_action('woocommerce_product_options_tax'); echo '</div>'; } do_action('woocommerce_product_options_general_product_data'); ?> </div> <div id="inventory_product_data" class="panel woocommerce_options_panel"> <?php echo '<div class="options_group">'; if ('yes' == get_option('woocommerce_manage_stock')) { // manage stock woocommerce_wp_checkbox(array('id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce'), 'description' => __('Enable stock management at product level', 'woocommerce'))); do_action('woocommerce_product_options_stock'); echo '<div class="stock_fields show_if_simple show_if_variable">'; // Stock woocommerce_wp_text_input(array('id' => '_stock', 'label' => __('Stock Qty', 'woocommerce'), 'desc_tip' => true, 'description' => __('Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => 'any'), 'data_type' => 'stock')); // Backorders? woocommerce_wp_select(array('id' => '_backorders', 'label' => __('Allow Backorders?', 'woocommerce'), 'options' => array('no' => __('Do not allow', 'woocommerce'), 'notify' => __('Allow, but notify customer', 'woocommerce'), 'yes' => __('Allow', 'woocommerce')), 'desc_tip' => true, 'description' => __('If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce'))); do_action('woocommerce_product_options_stock_fields'); echo '</div>'; } // Stock status woocommerce_wp_select(array('id' => '_stock_status', 'wrapper_class' => 'hide_if_variable', 'label' => __('Stock status', 'woocommerce'), 'options' => array('instock' => __('In stock', 'woocommerce'), 'outofstock' => __('Out of stock', 'woocommerce')), 'desc_tip' => true, 'description' => __('Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce'))); do_action('woocommerce_product_options_stock_status'); echo '</div>'; echo '<div class="options_group show_if_simple show_if_variable">'; // Individual product woocommerce_wp_checkbox(array('id' => '_sold_individually', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Sold Individually', 'woocommerce'), 'description' => __('Enable this to only allow one of this item to be bought in a single order', 'woocommerce'))); do_action('woocommerce_product_options_sold_individually'); echo '</div>'; do_action('woocommerce_product_options_inventory_product_data'); ?> </div> <div id="shipping_product_data" class="panel woocommerce_options_panel"> <?php echo '<div class="options_group">'; // Weight if (wc_product_weight_enabled()) { woocommerce_wp_text_input(array('id' => '_weight', 'label' => __('Weight', 'woocommerce') . ' (' . get_option('woocommerce_weight_unit') . ')', 'placeholder' => wc_format_localized_decimal(0), 'desc_tip' => 'true', 'description' => __('Weight in decimal form', 'woocommerce'), 'type' => 'text', 'data_type' => 'decimal')); } // Size fields if (wc_product_dimensions_enabled()) { ?> <p class="form-field dimensions_field"> <label for="product_length"><?php echo __('Dimensions', 'woocommerce') . ' (' . get_option('woocommerce_dimension_unit') . ')'; ?> </label> <span class="wrap"> <input id="product_length" placeholder="<?php _e('Length', 'woocommerce'); ?> " class="input-text wc_input_decimal" size="6" type="text" name="_length" value="<?php echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_length', true))); ?> " /> <input placeholder="<?php _e('Width', 'woocommerce'); ?> " class="input-text wc_input_decimal" size="6" type="text" name="_width" value="<?php echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_width', true))); ?> " /> <input placeholder="<?php _e('Height', 'woocommerce'); ?> " class="input-text wc_input_decimal last" size="6" type="text" name="_height" value="<?php echo esc_attr(wc_format_localized_decimal(get_post_meta($thepostid, '_height', true))); ?> " /> </span> <img class="help_tip" data-tip="<?php esc_attr_e('LxWxH in decimal form', 'woocommerce'); ?> " src="<?php echo esc_url(WC()->plugin_url()); ?> /assets/images/help.png" height="16" width="16" /> </p><?php } do_action('woocommerce_product_options_dimensions'); echo '</div>'; echo '<div class="options_group">'; // Shipping Class $classes = get_the_terms($thepostid, 'product_shipping_class'); if ($classes && !is_wp_error($classes)) { $current_shipping_class = current($classes)->term_id; } else { $current_shipping_class = ''; } $args = array('taxonomy' => 'product_shipping_class', 'hide_empty' => 0, 'show_option_none' => __('No shipping class', 'woocommerce'), 'name' => 'product_shipping_class', 'id' => 'product_shipping_class', 'selected' => $current_shipping_class, 'class' => 'select short'); ?> <p class="form-field dimensions_field"><label for="product_shipping_class"><?php _e('Shipping class', 'woocommerce'); ?> </label> <?php wp_dropdown_categories($args); ?> <img class="help_tip" data-tip="<?php esc_attr_e('Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce'); ?> " src="<?php echo esc_url(WC()->plugin_url()); ?> /assets/images/help.png" height="16" width="16" /></p><?php do_action('woocommerce_product_options_shipping'); echo '</div>'; ?> </div> <div id="product_attributes" class="panel wc-metaboxes-wrapper"> <div class="product_attributes wc-metaboxes"> <?php global $wc_product_attributes; // Array of defined attribute taxonomies $attribute_taxonomies = wc_get_attribute_taxonomies(); // Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set $attributes = maybe_unserialize(get_post_meta($thepostid, '_product_attributes', true)); // Output All Set Attributes if (!empty($attributes)) { $attribute_keys = array_keys($attributes); $attribute_total = sizeof($attribute_keys); for ($i = 0; $i < $attribute_total; $i++) { $attribute = $attributes[$attribute_keys[$i]]; $position = empty($attribute['position']) ? 0 : absint($attribute['position']); $taxonomy = ''; $metabox_class = array(); if ($attribute['is_taxonomy']) { $taxonomy = $attribute['name']; if (!taxonomy_exists($taxonomy)) { continue; } $attribute_taxonomy = $wc_product_attributes[$taxonomy]; $metabox_class[] = 'taxonomy'; $metabox_class[] = $taxonomy; $attribute_label = wc_attribute_label($taxonomy); } else { $attribute_label = apply_filters('woocommerce_attribute_label', $attribute['name'], $attribute['name']); } include 'views/html-product-attribute.php'; } } ?> </div> <p class="toolbar"> <button type="button" class="button button-primary add_attribute"><?php _e('Add', 'woocommerce'); ?> </button> <select name="attribute_taxonomy" class="attribute_taxonomy"> <option value=""><?php _e('Custom product attribute', 'woocommerce'); ?> </option> <?php if ($attribute_taxonomies) { foreach ($attribute_taxonomies as $tax) { $attribute_taxonomy_name = wc_attribute_taxonomy_name($tax->attribute_name); $label = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name; echo '<option value="' . esc_attr($attribute_taxonomy_name) . '">' . esc_html($label) . '</option>'; } } ?> </select> <button type="button" class="button save_attributes"><?php _e('Save attributes', 'woocommerce'); ?> </button> </p> <?php do_action('woocommerce_product_options_attributes'); ?> </div> <div id="linked_product_data" class="panel woocommerce_options_panel"> <div class="options_group"> <p class="form-field"> <label for="upsell_ids"><?php _e('Up-Sells', 'woocommerce'); ?> </label> <input type="hidden" class="wc-product-search" style="width: 50%;" id="upsell_ids" name="upsell_ids" data-placeholder="<?php _e('Search for a product…', 'woocommerce'); ?> " data-action="woocommerce_json_search_products" data-multiple="true" data-exclude="<?php echo intval($post->ID); ?> " data-selected="<?php $product_ids = array_filter(array_map('absint', (array) get_post_meta($post->ID, '_upsell_ids', true))); $json_ids = array(); foreach ($product_ids as $product_id) { $product = wc_get_product($product_id); if (is_object($product)) { $json_ids[$product_id] = wp_kses_post(html_entity_decode($product->get_formatted_name())); } } echo esc_attr(json_encode($json_ids)); ?> " value="<?php echo implode(',', array_keys($json_ids)); ?> " /> <img class="help_tip" data-tip='<?php _e('Up-sells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive.', 'woocommerce'); ?> ' src="<?php echo WC()->plugin_url(); ?> /assets/images/help.png" height="16" width="16" /> </p> <p class="form-field"> <label for="crosssell_ids"><?php _e('Cross-Sells', 'woocommerce'); ?> </label> <input type="hidden" class="wc-product-search" style="width: 50%;" id="crosssell_ids" name="crosssell_ids" data-placeholder="<?php _e('Search for a product…', 'woocommerce'); ?> " data-action="woocommerce_json_search_products" data-multiple="true" data-exclude="<?php echo intval($post->ID); ?> " data-selected="<?php $product_ids = array_filter(array_map('absint', (array) get_post_meta($post->ID, '_crosssell_ids', true))); $json_ids = array(); foreach ($product_ids as $product_id) { $product = wc_get_product($product_id); if (is_object($product)) { $json_ids[$product_id] = wp_kses_post(html_entity_decode($product->get_formatted_name())); } } echo esc_attr(json_encode($json_ids)); ?> " value="<?php echo implode(',', array_keys($json_ids)); ?> " /> <img class="help_tip" data-tip='<?php _e('Cross-sells are products which you promote in the cart, based on the current product.', 'woocommerce'); ?> ' src="<?php echo WC()->plugin_url(); ?> /assets/images/help.png" height="16" width="16" /> </p> </div> <div class="options_group grouping show_if_simple show_if_external"> <p class="form-field"> <label for="parent_id"><?php _e('Grouping', 'woocommerce'); ?> </label> <input type="hidden" class="wc-product-search" style="width: 50%;" id="parent_id" name="parent_id" data-placeholder="<?php _e('Search for a product…', 'woocommerce'); ?> " data-action="woocommerce_json_search_grouped_products" data-allow_clear="true" data-multiple="false" data-exclude="<?php echo intval($post->ID); ?> " data-selected="<?php $parent_id = absint($post->post_parent); if ($parent_id) { $parent = wc_get_product($parent_id); if (is_object($parent)) { $parent_title = wp_kses_post(html_entity_decode($parent->get_formatted_name())); } echo esc_attr($parent_title); } ?> " value="<?php echo $parent_id ? $parent_id : ''; ?> " /> <img class="help_tip" data-tip='<?php _e('Set this option to make this product part of a grouped product.', 'woocommerce'); ?> ' src="<?php echo WC()->plugin_url(); ?> /assets/images/help.png" height="16" width="16" /> </p> <?php woocommerce_wp_hidden_input(array('id' => 'previous_parent_id', 'value' => absint($post->post_parent))); do_action('woocommerce_product_options_grouping'); ?> </div> <?php do_action('woocommerce_product_options_related'); ?> </div> <div id="advanced_product_data" class="panel woocommerce_options_panel"> <div class="options_group hide_if_external"> <?php // Purchase note woocommerce_wp_textarea_input(array('id' => '_purchase_note', 'label' => __('Purchase Note', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Enter an optional note to send the customer after purchase.', 'woocommerce'))); ?> </div> <div class="options_group"> <?php // menu_order woocommerce_wp_text_input(array('id' => 'menu_order', 'label' => __('Menu order', 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Custom ordering position.', 'woocommerce'), 'value' => intval($post->menu_order), 'type' => 'number', 'custom_attributes' => array('step' => '1'))); ?> </div> <div class="options_group reviews"> <?php woocommerce_wp_checkbox(array('id' => 'comment_status', 'label' => __('Enable reviews', 'woocommerce'), 'cbvalue' => 'open', 'value' => esc_attr($post->comment_status))); do_action('woocommerce_product_options_reviews'); ?> </div> <?php do_action('woocommerce_product_options_advanced'); ?> </div> <?php self::output_variations(); do_action('woocommerce_product_data_panels'); do_action('woocommerce_product_write_panels'); // _deprecated ?> <div class="clear"></div> </div> <?php }
<div id="advanced_product_data" class="panel woocommerce_options_panel hidden"> <div class="options_group hide_if_external"> <?php woocommerce_wp_textarea_input(array('id' => '_purchase_note', 'value' => $product_object->get_purchase_note('edit'), 'label' => __('Purchase note', 'woocommerce'), 'desc_tip' => true, 'description' => __('Enter an optional note to send the customer after purchase.', 'woocommerce'))); ?> </div> <div class="options_group"> <?php woocommerce_wp_text_input(array('id' => 'menu_order', 'value' => $product_object->get_menu_order('edit'), 'label' => __('Menu order', 'woocommerce'), 'desc_tip' => true, 'description' => __('Custom ordering position.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array('step' => '1'))); ?> </div> <div class="options_group reviews"> <?php woocommerce_wp_checkbox(array('id' => '_reviews_allowed', 'value' => $product_object->get_reviews_allowed('edit') ? 'open' : 'closed', 'label' => __('Enable reviews', 'woocommerce'), 'cbvalue' => 'open')); do_action('woocommerce_product_options_reviews'); ?> </div> <?php do_action('woocommerce_product_options_advanced'); ?> </div>
/** * Add entry content to Product Settings. */ public function action_product_write_panels() { global $thepostid, $post; if (!$thepostid) { $thepostid = $post->ID; } ?> <script type="text/javascript"> jQuery( document ).ready( function () { var e = jQuery( '#bulkdiscount_product_data' ); <?php for ($i = 1; $i <= 6; $i++) { ?> e.find( '.block<?php echo $i; ?> ' ).hide(); e.find( '.options_group<?php echo max($i, 2); ?> ' ).hide(); e.find( '#add_discount_line<?php echo max($i, 2); ?> ' ).hide(); e.find( '#add_discount_line<?php echo $i; ?> ' ).click( function () { if ( <?php echo $i; ?> == 1 || ( e.find( '#_bulkdiscount_quantity_<?php echo max($i - 1, 1); ?> ' ).val() != '' && <?php if (get_option('woocommerce_t4m_discount_type', '') == 'flat') { ?> e.find( '#_bulkdiscount_discount_flat_<?php echo max($i - 1, 1); ?> ' ).val() != '' <?php } else { ?> e.find( '#_bulkdiscount_discount_<?php echo max($i - 1, 1); ?> ' ).val() != '' <?php } ?> ) ) { e.find( '.block<?php echo $i; ?> ' ).show( 400 ); e.find( '.options_group<?php echo min($i + 1, 6); ?> ' ).show( 400 ); e.find( '#add_discount_line<?php echo min($i + 1, 5); ?> ' ).show( 400 ); e.find( '#add_discount_line<?php echo $i; ?> ' ).hide( 400 ); e.find( '#delete_discount_line<?php echo min($i + 1, 6); ?> ' ).show( 400 ); e.find( '#delete_discount_line<?php echo $i; ?> ' ).hide( 400 ); } else { alert( '<?php _e('Please fill in the current line before adding new line.', 'wc_bulk_discount'); ?> ' ); } } ); e.find( '#delete_discount_line<?php echo max($i, 1); ?> ' ).hide(); e.find( '#delete_discount_line<?php echo $i; ?> ' ).click( function () { e.find( '.block<?php echo max($i - 1, 1); ?> ' ).hide( 400 ); e.find( '.options_group<?php echo min($i, 6); ?> ' ).hide( 400 ); e.find( '#add_discount_line<?php echo min($i, 5); ?> ' ).hide( 400 ); e.find( '#add_discount_line<?php echo max($i - 1, 1); ?> ' ).show( 400 ); e.find( '#delete_discount_line<?php echo min($i, 6); ?> ' ).hide( 400 ); e.find( '#delete_discount_line<?php echo max($i - 1, 2); ?> ' ).show( 400 ); e.find( '#_bulkdiscount_quantity_<?php echo max($i - 1, 1); ?> ' ).val( '' ); <?php if (get_option('woocommerce_t4m_discount_type', '') == 'flat') { ?> e.find( '#_bulkdiscount_discount_flat_<?php echo max($i - 1, 1); ?> ' ).val( '' ); <?php } else { ?> e.find( '#_bulkdiscount_discount_<?php echo max($i - 1, 1); ?> ' ).val( '' ); <?php } ?> } ); <?php } for ($i = 1, $j = 2; $i <= 5; $i++, $j++) { $cnt = 1; if (get_post_meta($thepostid, "_bulkdiscount_quantity_{$i}", true) || get_post_meta($thepostid, "_bulkdiscount_quantity_{$j}", true)) { ?> e.find( '.block<?php echo $i; ?> ' ).show(); e.find( '.options_group<?php echo $i; ?> ' ).show(); e.find( '#add_discount_line<?php echo $i; ?> ' ).hide(); e.find( '#delete_discount_line<?php echo $i; ?> ' ).hide(); e.find( '.options_group<?php echo min($i + 1, 6); ?> ' ).show(); e.find( '#add_discount_line<?php echo min($i + 1, 6); ?> ' ).show(); e.find( '#delete_discount_line<?php echo min($i + 1, 6); ?> ' ).show(); <?php $cnt++; } } if ($cnt >= 6) { ?> e.find( '#add_discount_line6' ).show(); <?php } ?> } ); </script> <div id="bulkdiscount_product_data" class="panel woocommerce_options_panel"> <div class="options_group"> <?php woocommerce_wp_checkbox(array('id' => '_bulkdiscount_enabled', 'value' => get_post_meta($thepostid, '_bulkdiscount_enabled', true) ? get_post_meta($thepostid, '_bulkdiscount_enabled', true) : 'yes', 'label' => __('Bulk Discount enabled', 'wc_bulk_discount'))); woocommerce_wp_textarea_input(array('id' => "_bulkdiscount_text_info", 'label' => __('Bulk discount special offer text in product description', 'wc_bulk_discount'), 'description' => __('Optionally enter bulk discount information that will be visible on the product page.', 'wc_bulk_discount'), 'desc_tip' => 'yes', 'class' => 'fullWidth')); ?> </div> <?php for ($i = 1; $i <= 5; $i++) { ?> <div class="options_group<?php echo $i; ?> "> <a id="add_discount_line<?php echo $i; ?> " class="button-secondary" href="#block<?php echo $i; ?> "><?php _e('Add discount line', 'wc_bulk_discount'); ?> </a> <a id="delete_discount_line<?php echo $i; ?> " class="button-secondary" href="#block<?php echo $i; ?> "><?php _e('Remove last discount line', 'wc_bulk_discount'); ?> </a> <div class="block<?php echo $i; ?> <?php echo $i % 2 == 0 ? 'even' : 'odd'; ?> "> <?php woocommerce_wp_text_input(array('id' => "_bulkdiscount_quantity_{$i}", 'label' => __('Quantity (min.)', 'wc_bulk_discount'), 'type' => 'number', 'description' => __('Enter the minimal quantity for which the discount applies.', 'wc_bulk_discount'), 'custom_attributes' => array('step' => '1', 'min' => '1'))); if (get_option('woocommerce_t4m_discount_type', '') == 'flat') { woocommerce_wp_text_input(array('id' => "_bulkdiscount_discount_flat_{$i}", 'type' => 'number', 'label' => sprintf(__('Discount (%s)', 'wc_bulk_discount'), get_woocommerce_currency_symbol()), 'description' => sprintf(__('Enter the flat discount in %s.', 'wc_bulk_discount'), get_woocommerce_currency_symbol()), 'custom_attributes' => array('step' => 'any', 'min' => '0'))); } else { woocommerce_wp_text_input(array('id' => "_bulkdiscount_discount_{$i}", 'type' => 'number', 'label' => __('Discount (%)', 'wc_bulk_discount'), 'description' => __('Enter the discount in percents (Allowed values: 0 to 100).', 'wc_bulk_discount'), 'custom_attributes' => array('step' => 'any', 'min' => '0', 'max' => '100'))); } ?> </div> </div> <?php } ?> <div class="options_group6"> <a id="delete_discount_line6" class="button-secondary" href="#block6"><?php _e('Remove last discount line', 'wc_bulk_discount'); ?> </a> </div> <br/> </div> <?php }
/** * function add additional field to disable email restriction */ public function sc_woocommerce_coupon_options_usage_restriction() { woocommerce_wp_checkbox(array('id' => 'sc_disable_email_restriction', 'label' => __('Disable Email restriction?', self::$text_domain), 'description' => __('When checked, no e-mail id will be added through Smart Coupons plugin.', self::$text_domain))); }
<?php // Select woocommerce_wp_select(array('id' => $public_perfix . 'tab_sticky_width', 'label' => __('Content Width', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Enter Sticky Content Width.', EXTRA_WOO_TABS_TEXTDOMAN), 'desc_tip' => 'true', 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_sticky_width'], 'options' => array('pw-content-1' => '2:3', 'pw-content-2' => '1:2', 'pw-content-3' => '1:3', 'pw-content-4' => '1:4', 'pw-content-full' => __('Full', EXTRA_WOO_TABS_TEXTDOMAN)))); $dependency = array('parent_id' => $public_perfix . 'tab_sticky_enabled', 'value' => 'true'); dependency($public_perfix . 'tab_sticky_width', $dependency); ?> <?php // Number Field woocommerce_wp_text_input(array('id' => $public_perfix . 'tab_sticky_height', 'label' => __('Content Height (Pixel)', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Enter Sticky Content Height.', EXTRA_WOO_TABS_TEXTDOMAN), 'type' => 'number', 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_sticky_height'], 'custom_attributes' => array('step' => 'any', 'min' => '0'))); $dependency = array('parent_id' => $public_perfix . 'tab_sticky_enabled', 'value' => 'true'); dependency($public_perfix . 'tab_sticky_height', $dependency); ?> <?php // Select woocommerce_wp_select(array('id' => $public_perfix . 'tab_sticky_position', 'label' => __('Sticky Button Position', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('Choose Sticky Position', EXTRA_WOO_TABS_TEXTDOMAN), 'desc_tip' => 'true', 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_sticky_position'], 'options' => array('pw-left-stick' => __('Left Side', EXTRA_WOO_TABS_TEXTDOMAN), 'pw-right-stick' => __('Right Side', EXTRA_WOO_TABS_TEXTDOMAN)))); $dependency = array('parent_id' => $public_perfix . 'tab_sticky_enabled', 'value' => 'true'); dependency($public_perfix . 'tab_sticky_position', $dependency); ?> <?php if ($product_tab_use_all == 'on') { woocommerce_wp_checkbox(array('id' => $public_perfix . 'tab_content_changed', 'label' => __('Content Changed', EXTRA_WOO_TABS_TEXTDOMAN), 'description' => __('If You Change Below Content, Please Check This Features', EXTRA_WOO_TABS_TEXTDOMAN), 'value' => $custom_tab_options['public_fields'][$public_perfix . 'tab_content_changed'], 'cbvalue' => 'yes')); } ?> </div> </div> </div> </div>
woocommerce_wp_text_input(array('id' => '_wc_booking_min_duration', 'label' => __('Minimum duration', 'woocommerce-bookings'), 'description' => __('The minimum allowed duration the user can input.', 'woocommerce-bookings'), 'value' => max(absint(get_post_meta($post_id, '_wc_booking_min_duration', true)), 1), 'desc_tip' => true, 'type' => 'number', 'custom_attributes' => array('min' => '', 'step' => '1'))); woocommerce_wp_text_input(array('id' => '_wc_booking_max_duration', 'label' => __('Maximum duration', 'woocommerce-bookings'), 'description' => __('The maximum allowed duration the user can input.', 'woocommerce-bookings'), 'value' => max(absint(get_post_meta($post_id, '_wc_booking_max_duration', true)), 1), 'desc_tip' => true, 'type' => 'number', 'custom_attributes' => array('min' => '', 'step' => '1'))); ?> <div id="enable-range-picker"> <?php woocommerce_wp_checkbox(array('id' => '_wc_booking_enable_range_picker', 'label' => __('Enable Calendar Range Picker?', 'woocommerce-bookings'), 'description' => __('Lets the user select a start and end date on the calendar - duration will be calculated automatically.', 'woocommerce-bookings'))); ?> </div> </div> <?php woocommerce_wp_select(array('id' => '_wc_booking_calendar_display_mode', 'label' => __('Calendar display mode', 'woocommerce-bookings'), 'description' => __('Choose how the calendar is displayed on the booking form.', 'woocommerce-bookings'), 'options' => array('' => __('Display calendar on click', 'woocommerce-bookings'), 'always_visible' => __('Calendar always visible', 'woocommerce-bookings')), 'desc_tip' => true, 'class' => 'select')); woocommerce_wp_checkbox(array('id' => '_wc_booking_requires_confirmation', 'label' => __('Requires confirmation?', 'woocommerce-bookings'), 'description' => __('Check this box if the booking requires admin approval/confirmation. Payment will not be taken during checkout.', 'woocommerce-bookings'))); woocommerce_wp_checkbox(array('id' => '_wc_booking_user_can_cancel', 'label' => __('Can be cancelled?', 'woocommerce-bookings'), 'description' => __('Check this box if the booking can be cancelled by the customer after it has been purchased. A refund will not be sent automatically.', 'woocommerce-bookings'))); $cancel_limit = max(absint(get_post_meta($post_id, '_wc_booking_cancel_limit', true)), 1); $cancel_limit_unit = get_post_meta($post_id, '_wc_booking_cancel_limit_unit', true); ?> <p class="form-field booking-cancel-limit"> <label for="_wc_booking_cancel_limit"><?php _e('Booking can be cancelled until', 'woocommerce-bookings'); ?> </label> <input type="number" name="_wc_booking_cancel_limit" id="_wc_booking_cancel_limit" value="<?php echo $cancel_limit; ?> " step="1" min="1" style="margin-right: 7px; width: 4em;"> <select name="_wc_booking_cancel_limit_unit" id="_wc_booking_cancel_limit_unit" class="short" style="width: auto; margin-right: 7px;"> <option value="month" <?php selected($cancel_limit_unit, 'month');
public function meta_box_inner($post) { wp_nonce_field('wc_bookings_details_meta_box', 'wc_bookings_details_meta_box_nonce'); // Scripts. wp_enqueue_script('ajax-chosen'); wp_enqueue_script('chosen'); wp_enqueue_script('jquery-ui-datepicker'); $customer_id = get_post_meta($post->ID, '_booking_customer_id', true); $order_parent_id = apply_filters('woocommerce_order_number', _x('#', 'hash before order number', 'woocommerce-bookings') . $post->post_parent, $post->post_parent); ?> <style type="text/css"> #post-body-content, #titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none } </style> <div class="panel-wrap woocommerce"> <div id="booking_data" class="panel"> <h2><?php _e('Booking Details', 'woocommerce-bookings'); ?> </h2> <p class="booking_number"><?php printf(__('Booking number: #%s.', 'woocommerce-bookings'), esc_html($post->ID)); if ($post->post_parent) { $order = new WC_Order($post->post_parent); printf(' ' . __('Order number: %s.', 'woocommerce-bookings'), '<a href="' . admin_url('post.php?post=' . absint($post->post_parent) . '&action=edit') . '">' . esc_html($order->get_order_number()) . '</a>'); } ?> </p> <div class="booking_data_column_container"> <div class="booking_data_column"> <h4><?php _e('General Details', 'woocommerce-bookings'); ?> </h4> <p class="form-field form-field-wide"> <label for="_booking_order_id"><?php _e('Order ID:', 'woocommerce-bookings'); ?> </label> <select id="_booking_order_id" name="_booking_order_id" class="ajax_chosen_select_booking_order_id" data-placeholder="<?php _e('Select an order…', 'woocommerce-bookings'); ?> "> <?php if ($post->post_parent) { echo '<option value="' . esc_attr($post->post_parent) . '" ' . selected(1, 1, false) . '>' . $order_parent_id . ' – ' . esc_html(get_the_title($post->post_parent)) . '</option>'; } ?> </select> </p> <p class="form-field form-field-wide"><label for="booking_date"><?php _e('Date created:', 'woocommerce-bookings'); ?> </label> <input type="text" class="date-picker-field" name="booking_date" id="booking_date" maxlength="10" value="<?php echo date_i18n('Y-m-d', strtotime($post->post_date)); ?> " pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> @ <input type="text" class="hour" placeholder="<?php _e('h', 'woocommerce-bookings'); ?> " name="booking_date_hour" id="booking_date_hour" maxlength="2" size="2" value="<?php echo date_i18n('H', strtotime($post->post_date)); ?> " pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php _e('m', 'woocommerce-bookings'); ?> " name="booking_date_minute" id="booking_date_minute" maxlength="2" size="2" value="<?php echo date_i18n('i', strtotime($post->post_date)); ?> " pattern="\-?\d+(\.\d{0,})?" /> </p> <?php $statuses = array('unpaid' => __('unpaid', 'woocommerce-bookings'), 'pending' => __('pending', 'woocommerce-bookings'), 'confirmed' => __('confirmed', 'woocommerce-bookings'), 'paid' => __('paid', 'woocommerce-bookings'), 'cancelled' => __('cancelled', 'woocommerce-bookings'), 'complete' => __('complete', 'woocommerce-bookings')); ?> <p class="form-field form-field-wide"> <label for="_booking_status"><?php _e('Booking Status:', 'woocommerce-bookings'); ?> </label> <select id="_booking_status" name="_booking_status"> <?php foreach ($statuses as $key => $value) { echo '<option value="' . esc_attr($key) . '" ' . selected($key, $post->post_status, false) . '>' . esc_html__($value, 'woocommerce-bookings') . '</option>'; } ?> </select> </p> <p class="form-field form-field-wide"> <label for="_booking_customer_id"><?php _e('Customer:', 'woocommerce-bookings'); ?> </label> <select id="_booking_customer_id" name="_booking_customer_id" class="ajax_chosen_select_customer"> <option value=""><?php _e('Guest', 'woocommerce-bookings'); ?> </option> <?php if ($customer_id) { $user = get_user_by('id', $customer_id); echo '<option value="' . esc_attr($user->ID) . '" ' . selected(1, 1, false) . '>' . esc_html($user->display_name) . ' (#' . absint($user->ID) . ' – ' . esc_html($user->user_email) . ')</option>'; } ?> </select> </p> <?php do_action('woocommerce_admin_booking_data_after_booking_details', $post->ID); ?> </div> <div class="booking_data_column"> <h4><?php _e('Booking Specification', 'woocommerce-bookings'); ?> </h4> <?php $bookable_products = array('' => __('N/A', 'woocommerce-bookings')); $products = WC_Bookings_Admin::get_booking_products(); foreach ($products as $product) { $bookable_products[$product->ID] = $product->post_title; $resources = wc_booking_get_product_resources($product->ID); foreach ($resources as $resource) { $bookable_products[$product->ID . '=>' . $resource->ID] = ' ' . $resource->post_title; } } $product_id = get_post_meta($post->ID, '_booking_product_id', true); $resource_id = get_post_meta($post->ID, '_booking_resource_id', true); woocommerce_wp_select(array('id' => 'product_or_resource_id', 'label' => __('Booked Product', 'woocommerce-bookings'), 'options' => $bookable_products, 'value' => $resource_id ? $product_id . '=>' . $resource_id : $product_id)); woocommerce_wp_text_input(array('id' => '_booking_parent_id', 'label' => __('Parent Booking ID', 'woocommerce-bookings'), 'placeholder' => 'N/A')); $persons = get_post_meta($post->ID, '_booking_persons', true); if (!empty($persons) && is_array($persons)) { echo '<br class="clear" />'; echo '<h4>' . __('Person(s)', 'woocommerce-bookings') . '</h4>'; foreach ($persons as $person_id => $person_count) { woocommerce_wp_text_input(array('id' => '_booking_person_' . $person_id, 'label' => get_the_title($person_id), 'placeholder' => '0', 'value' => $person_count, 'wrapper_class' => 'booking-person')); } } ?> </div> <div class="booking_data_column"> <h4><?php _e('Booking Date/Time', 'woocommerce-bookings'); ?> </h4> <?php woocommerce_wp_text_input(array('id' => 'booking_start_date', 'label' => __('Start date', 'woocommerce-bookings'), 'placeholder' => 'yyyy-mm-dd', 'value' => date('Y-m-d', strtotime(get_post_meta($post->ID, '_booking_start', true))), 'class' => 'date-picker-field')); woocommerce_wp_text_input(array('id' => 'booking_end_date', 'label' => __('End date', 'woocommerce-bookings'), 'placeholder' => 'yyyy-mm-dd', 'value' => date('Y-m-d', strtotime(get_post_meta($post->ID, '_booking_end', true))), 'class' => 'date-picker-field')); woocommerce_wp_checkbox(array('id' => '_booking_all_day', 'label' => __('All day', 'woocommerce-bookings'), 'description' => __('Check this box if the booking is for all day.', 'woocommerce-bookings'), 'value' => get_post_meta($post->ID, '_booking_all_day', true) ? 'yes' : 'no')); woocommerce_wp_text_input(array('id' => 'booking_start_time', 'label' => __('Start time', 'woocommerce-bookings'), 'placeholder' => 'hh:mm', 'value' => date('H:i', strtotime(get_post_meta($post->ID, '_booking_start', true))), 'class' => 'datepicker')); woocommerce_wp_text_input(array('id' => 'booking_end_time', 'label' => __('End time', 'woocommerce-bookings'), 'placeholder' => 'hh:mm', 'value' => date('H:i', strtotime(get_post_meta($post->ID, '_booking_end', true))))); ?> </div> </div> <div class="clear"></div> </div> <?php wc_enqueue_js("\n\t\t\t\t\$( '#_booking_all_day' ).change( function () {\n\t\t\t\t\tif ( \$( this ).is( ':checked' ) ) {\n\t\t\t\t\t\t\$( '#booking_start_time, #booking_end_time' ).closest( 'p' ).hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\$( '#booking_start_time, #booking_end_time' ).closest( 'p' ).show();\n\t\t\t\t\t}\n\t\t\t\t}).change();\n\n\t\t\t\t\$( 'select#_booking_order_id' ).ajaxChosen({\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\turl: '" . admin_url('admin-ajax.php') . "',\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\tafterTypeDelay: 100,\n\t\t\t\t\tminTermLength: 1,\n\t\t\t\t\tdata: {\n\t\t\t\t\t\taction: 'wc_bookings_json_search_order',\n\t\t\t\t\t\tsecurity: '" . wp_create_nonce('search-booking-order') . "'\n\t\t\t\t\t}\n\t\t\t\t}, function ( data ) {\n\n\t\t\t\t\tvar orders = {};\n\n\t\t\t\t\t\$.each( data, function ( i, val ) {\n\t\t\t\t\t\torders[i] = val;\n\t\t\t\t\t});\n\n\t\t\t\t\treturn orders;\n\t\t\t\t});\n\n\t\t\t\t\$( 'select#_booking_status' ).chosen({\n\t\t\t\t\tdisable_search: true\n\t\t\t\t});\n\n\t\t\t\t\$( 'select.ajax_chosen_select_customer' ).ajaxChosen({\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\turl: '" . admin_url('admin-ajax.php') . "',\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\tafterTypeDelay: 100,\n\t\t\t\t\tminTermLength: 1,\n\t\t\t\t\tdata: {\n\t\t\t\t\t\taction: 'woocommerce_json_search_customers',\n\t\t\t\t\t\tsecurity: '" . wp_create_nonce('search-customers') . "'\n\t\t\t\t\t}\n\t\t\t\t}, function ( data ) {\n\n\t\t\t\t\tvar terms = {};\n\n\t\t\t\t\t\$.each( data, function ( i, val ) {\n\t\t\t\t\t\tterms[i] = val;\n\t\t\t\t\t});\n\n\t\t\t\t\treturn terms;\n\t\t\t\t});\n\n\t\t\t\t\$( 'select#product_or_resource_id' ).chosen();\n\n\t\t\t\t\$( '.date-picker-field' ).datepicker({\n\t\t\t\t\tdateFormat: 'yy-mm-dd',\n\t\t\t\t\tnumberOfMonths: 1,\n\t\t\t\t\tshowButtonPanel: true,\n\t\t\t\t});\n\t\t\t"); }
/** * Creates the Giftcard Regenerate Meta Box in the admin control panel when in the Giftcard Post Type. Allows you to click a button regenerate the number. * @param [type] $post * @return [type] */ public function rpgc_options_meta_box($post) { global $woocommerce; wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce'); echo '<div id="giftcard_regenerate" class="panel woocommerce_options_panel">'; echo ' <div class="options_group">'; if ($post->post_status != 'zerobalance') { // Regenerate the Card Number woocommerce_wp_checkbox(array('id' => 'rpgc_resend_email', 'label' => __('Send Gift Card Email', 'rpgiftcards'))); // Regenerate the Card Number woocommerce_wp_checkbox(array('id' => 'rpgc_regen_number', 'label' => __('Regenerate Card Number', 'rpgiftcards'))); do_action('rpgc_add_more_options'); } else { _e('No additional options available. Zero balance', 'rpgiftcards'); } echo ' </div>'; echo '</div>'; }
/** * Coupon data meta box * * Displays the meta box */ function woocommerce_coupon_data_meta_box($post) { global $woocommerce; wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce'); ?> <style type="text/css"> #edit-slug-box { display:none } </style> <div id="coupon_options" class="panel woocommerce_options_panel"> <?php // Type woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => $woocommerce->get_coupon_discount_types())); // Amount woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => __('0.00', 'woocommerce'), 'description' => __('Enter an amount e.g. 2.99', 'woocommerce'))); // Individual use woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons', 'woocommerce'))); // Apply before tax woocommerce_wp_checkbox(array('id' => 'apply_before_tax', 'label' => __('Apply before tax', 'woocommerce'), 'description' => __('Check this box if the coupon should be applied before calculating cart tax', 'woocommerce'))); // Free Shipping woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Enable free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon enables free shipping (see <a href="%s">Free Shipping</a>)', 'woocommerce'), admin_url('admin.php?page=woocommerce&tab=shipping_methods&subtab=shipping-free_shipping')))); // Product ids woocommerce_wp_text_input(array('id' => 'product_ids', 'label' => __('Product IDs', 'woocommerce'), 'placeholder' => __('N/A', 'woocommerce'), 'description' => __('(optional) Comma separate IDs which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce'))); // Exclude Product ids woocommerce_wp_text_input(array('id' => 'exclude_product_ids', 'label' => __('Exclude Product IDs', 'woocommerce'), 'placeholder' => __('N/A', 'woocommerce'), 'description' => __('(optional) Comma separate IDs which must not be in the cart to use this coupon or, for "Product Discounts", which products are not discounted.', 'woocommerce'))); // Usage limit woocommerce_wp_text_input(array('id' => 'usage_limit', 'label' => __('Usage limit', 'woocommerce'), 'placeholder' => __('Unlimited usage', 'woocommerce'), 'description' => __('(optional) How many times this coupon can be used before it is void', 'woocommerce'))); // Expiry date woocommerce_wp_text_input(array('id' => 'expiry_date', 'label' => __('Expiry date', 'woocommerce'), 'placeholder' => __('Never expire', 'woocommerce'), 'description' => __('(optional) The date this coupon will expire, <code>YYYY-MM-DD</code>', 'woocommerce'), 'class' => 'short date-picker')); do_action('woocommerce_coupon_options'); ?> </div> <?php }
function woogle_custom_general_fields() { global $post; echo '<div class="options_group woogle-options-group">'; // Enable Google Shopping woocommerce_wp_checkbox(array('id' => '_woogle_enabled', 'label' => __('Enable Google Shopping', 'woogle'), 'desc_tip' => true, 'description' => __('Select to upload this product to your Google Merchant Center', 'woogle'))); echo __('<h3>Product Description</h3>', 'woogle'); // Title woocommerce_wp_text_input(array('id' => '_woogle_title', 'label' => __('Woogle Title', 'woogle'), 'placeholder' => '(Limit 150 characters)', 'desc_tip' => false, 'description' => __('Enter a custom value to override the title for this product.<br />(Limit 150 characters)', 'woogle'))); // Description woocommerce_wp_textarea_input(array('id' => '_woogle_description', 'label' => __('Woogle Description', 'woogle'), 'placeholder' => '(Limit 5000 characters)', 'desc_tip' => false, 'description' => __('Enter a custom value to override the description for this product.<br />(Limit 5000 characters)', 'woogle'))); echo __('<h3>Product Identification</h3>', 'woogle'); // Condition woocommerce_wp_select(array('id' => '_woogle_condition', 'label' => __('Condition', 'woogle'), 'options' => array('new' => __('New', 'woogle'), 'used' => __('Used', 'woogle'), 'refurbished' => __('Refurbished', 'woogle')), 'desc_tip' => true, 'description' => __('Condition of the item', 'woogle'))); // Category woocommerce_wp_text_input(array('id' => '_woogle_category', 'label' => __('Product Category', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Product Category from Google Shopping Content Category Taxonomy.', 'woogle'))); // Brand woocommerce_wp_text_input(array('id' => '_woogle_brand', 'label' => __('Brand', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The brand of the product.', 'woogle'))); // GTIN woocommerce_wp_text_input(array('id' => '_woogle_gtin', 'label' => __('GTIN', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Global Trade Item Number', 'woogle'))); // MPN woocommerce_wp_text_input(array('id' => '_woogle_mpn', 'label' => __('MPN', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('Manufacturer Part Number', 'woogle'))); echo __('<h3>Physical Properties</h3>', 'woogle'); // Color woocommerce_wp_text_input(array('id' => '_woogle_color', 'label' => __('Color', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The color of the product. If you are trying to indicate multiple colors for a ' . 'single item (not product variants), specify a primary color, optionally followed ' . 'by at most two secondary colors, separated by a \'/\'. Here replace RedPinkBlue ' . 'with Red/Pink/Blue', 'woogle'))); // Material woocommerce_wp_text_input(array('id' => '_woogle_material', 'label' => __('Material', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The material of the product.', 'woogle'))); // Pattern woocommerce_wp_text_input(array('id' => '_woogle_pattern', 'label' => __('Pattern', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The pattern of the product.', 'woogle'))); // Size woocommerce_wp_text_input(array('id' => '_woogle_size', 'label' => __('Size', 'woogle'), 'placeholder' => '', 'desc_tip' => true, 'description' => __('The size of the product.', 'woogle'))); echo __('<h3>Target Consumer</h3>', 'woogle'); // Age Group woocommerce_wp_select(array('id' => '_woogle_age_group', 'label' => __('Age Group', 'woogle'), 'options' => array('' => __('—SELECT—', 'woogle'), 'adult' => __('Adult', 'woogle'), 'infant' => __('Infant', 'woogle'), 'kids' => __('Kids', 'woogle'), 'newborn' => __('Newborn', 'woogle'), 'toddler' => __('Toddler', 'woogle')), 'desc_tip' => true, 'description' => __('The target age group of the product.', 'woogle'))); // Gender woocommerce_wp_select(array('id' => '_woogle_gender', 'label' => __('Gender', 'woogle'), 'options' => array('' => __('—SELECT—', 'woogle'), 'female' => __('Female', 'woogle'), 'male' => __('Male', 'woogle'), 'unisex' => __('Unisex', 'woogle')), 'desc_tip' => true, 'description' => __('The target gender of the product.', 'woogle'))); // Adult woocommerce_wp_checkbox(array('id' => '_woogle_adult', 'label' => __('Adult (18+)', 'woogle'), 'desc_tip' => true, 'description' => __('This item is targeted towards adults.', 'woogle'))); echo '</div>'; }