本文整理汇总了PHP中wc_product_weight_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_product_weight_enabled函数的具体用法?PHP wc_product_weight_enabled怎么用?PHP wc_product_weight_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_product_weight_enabled函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: esc_attr
echo '<option value="' . esc_attr($key === $_stock_status ? '' : $key) . '" ' . selected($key === $_stock_status, true, false) . '>' . esc_html($value) . '</option>';
}
?>
</select>
</p>
</div>
<?php
}
?>
<?php
if (wc_product_weight_enabled() || wc_product_dimensions_enabled()) {
?>
<div>
<?php
if (wc_product_weight_enabled()) {
?>
<p class="form-row hide_if_variation_virtual form-row-first">
<label><?php
echo __('Weight', 'woocommerce') . ' (' . esc_html(get_option('woocommerce_weight_unit')) . '):';
?>
<a class="tips" data-tip="<?php
_e('Enter a weight for this variation or leave blank to use the parent product weight.', 'woocommerce');
?>
" href="#">[?]</a></label>
<input type="text" size="5" name="variable_weight[<?php
echo $loop;
?>
]" value="<?php
if (isset($_weight)) {
echo esc_attr($_weight);
开发者ID:abcode619,项目名称:wpstuff,代码行数:31,代码来源:html-variation-admin.php
示例2: output
//.........这里部分代码省略.........
<?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)));
?>
" />
开发者ID:WordCommerce,项目名称:woocommerce,代码行数:67,代码来源:class-wc-meta-box-product-data.php
示例3: output
//.........这里部分代码省略.........
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 (not needed if managing stock at variation 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')));
do_action('woocommerce_product_options_stock_fields');
echo '</div>';
}
// Stock status
woocommerce_wp_select(array('id' => '_stock_status', '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')));
if (get_option('woocommerce_manage_stock') == 'yes') {
echo '<div class="show_if_simple show_if_variable">';
// 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 for this product and variations. If enabled, stock quantity can go below 0.', 'woocommerce')));
echo '</div>';
}
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)));
?>
" />
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:67,代码来源:class-wc-meta-box-product-data.php
示例4: bf_wc_shipping
function bf_wc_shipping($thepostid, $customfield)
{
?>
<div id="shipping_product_data" class="hide_if_virtual hide_if_grouped hide_if_external">
<?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') . ')<br>', '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><br>
<span class="wrap">
<input id="product_length" placeholder="<?php
_e('Length', 'woocommerce');
?>
" class="input-text wc_input_decimal dimensions_field" size="12" 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 dimensions_field" size="12" 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 dimensions_field" size="12" 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');
?>
<label for="product_shipping_class"><?php
_e('Shipping class', 'woocommerce');
?>
</label><p class="form-field dimensions_field"><?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>';
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:79,代码来源:bf-wc-product-shipping.php
示例5: output
/**
* 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="' . esc_attr__('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());
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">
<ul class="product_data_tabs wc-tabs" style="display:none;">
<?php
$product_data_tabs = apply_filters('woocommerce_product_data_tabs', array('attribute' => array('label' => __('Attributes', 'woocommerce'), 'target' => 'product_attributes', '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="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">
//.........这里部分代码省略.........
开发者ID:vkolova,项目名称:bgscena,代码行数:101,代码来源:class-wc-meta-box-product-data.php
示例6: bf_wc_variations_custom
//.........这里部分代码省略.........
echo '<option value="' . esc_attr($key) . '" ' . selected($key === $_backorders, true, false) . '>' . esc_html($value) . '</option>';
}
?>
</select>
</p>
</div>
<?php
}
?>
<div class="">
<p class="form-row form-row-full">
<label><?php
_e('Stock status', 'woocommerce');
?>
<a class="tips" data-tip="<?php
esc_attr_e('Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce');
?>
" href="#">[?]</a></label>
<select name="variable_stock_status[<?php
echo $loop;
?>
]">
<?php
foreach ($parent_data['stock_status_options'] as $key => $value) {
echo '<option value="' . esc_attr($key === $_stock_status ? '' : $key) . '" ' . selected($key === $_stock_status, true, false) . '>' . esc_html($value) . '</option>';
}
?>
</select>
</p>
</div>
<?php
if (wc_product_weight_enabled() || wc_product_dimensions_enabled()) {
?>
<div>
<?php
if (wc_product_weight_enabled()) {
?>
<p class="form-row hide_if_variation_virtual form-row-first">
<label><?php
echo __('Weight', 'woocommerce') . ' (' . esc_html(get_option('woocommerce_weight_unit')) . '):';
?>
<a class="tips" data-tip="<?php
esc_attr_e('Enter a weight for this variation or leave blank to use the parent product weight.', 'woocommerce');
?>
" href="#">[?]</a></label>
<input type="text" size="5" name="variable_weight[<?php
echo $loop;
?>
]" value="<?php
if (isset($_weight)) {
echo esc_attr($_weight);
}
?>
" placeholder="<?php
echo esc_attr($parent_data['weight']);
?>
" class="wc_input_decimal" />
</p>
<?php
} else {
?>
<p> </p>
<?php
}
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:67,代码来源:bf-wc-product-variations.php
注:本文中的wc_product_weight_enabled函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论