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rc.2 3.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / admin / meta-boxes / views / html-variation-admin.php
woocommerce / includes / admin / meta-boxes / views Last commit date
html-order-download-permission.php 6 years ago html-order-fee.php 3 months ago html-order-item-meta.php 4 years ago html-order-item.php 9 months ago html-order-items.php 1 month ago html-order-notes.php 1 month ago html-order-refund.php 3 months ago html-order-shipping.php 3 months ago html-product-attribute-inner.php 1 month ago html-product-attribute.php 3 years ago html-product-data-advanced.php 5 months ago html-product-data-attributes.php 1 month ago html-product-data-general.php 2 months ago html-product-data-inventory.php 4 months ago html-product-data-linked-products.php 3 months ago html-product-data-panel.php 1 year ago html-product-data-shipping.php 3 years ago html-product-data-variations.php 1 month ago html-product-download.php 4 months ago html-product-variation-download.php 4 months ago html-variation-admin.php 1 month ago
html-variation-admin.php
592 lines
1 <?php
2 /**
3 * Outputs a variation for editing.
4 *
5 * @package WooCommerce\Admin
6 * @var int $variation_id
7 * @var WP_POST $variation
8 * @var WC_Product_Variation $variation_object
9 * @var array $variation_data array of variation data @deprecated 4.4.0.
10 */
11
12 use Automattic\WooCommerce\Utilities\I18nUtil;
13
14 defined( 'ABSPATH' ) || exit;
15
16 ?>
17 <div class="woocommerce_variation wc-metabox closed">
18 <h3>
19 <a href="javascript:void(0)" class="edit_variation edit"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a>
20 <a href="#" class="remove_variation delete" rel="<?php echo esc_attr( $variation_id ); ?>"><?php esc_html_e( 'Remove', 'woocommerce' ); ?></a>
21 <div class="tips sort" data-tip="<?php esc_attr_e( 'Drag and drop, or click to set admin variation order', 'woocommerce' ); ?>"></div>
22 <strong>#<?php echo esc_html( $variation_id ); ?> </strong>
23 <?php
24 $attribute_values = $variation_object->get_attributes( 'edit' );
25
26 foreach ( $product_object->get_attributes( 'edit' ) as $attribute ) {
27 if ( ! $attribute->get_variation() ) {
28 continue;
29 }
30 $selected_value = isset( $attribute_values[ sanitize_title( $attribute->get_name() ) ] ) ? $attribute_values[ sanitize_title( $attribute->get_name() ) ] : '';
31 ?>
32 <select name="attribute_<?php echo esc_attr( sanitize_title( $attribute->get_name() ) . "[{$loop}]" ); ?>">
33 <option value="">
34 <?php
35 /* translators: %s: attribute label */
36 printf( esc_html__( 'Any %s&hellip;', 'woocommerce' ), wc_attribute_label( $attribute->get_name() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
37 ?>
38 </option>
39 <?php if ( $attribute->is_taxonomy() ) : ?>
40 <?php foreach ( $attribute->get_terms() as $option ) : ?>
41 <?php /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */ ?>
42 <option <?php selected( $selected_value, $option->slug ); ?> value="<?php echo esc_attr( $option->slug ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option->name, $option, $attribute->get_name(), $product_object ) ); ?></option>
43 <?php /* phpcs:enable */ ?>
44 <?php endforeach; ?>
45 <?php else : ?>
46 <?php foreach ( $attribute->get_options() as $option ) : ?>
47 <?php /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */ ?>
48 <option <?php selected( $selected_value, $option ); ?> value="<?php echo esc_attr( $option ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute->get_name(), $product_object ) ); ?></option>
49 <?php /* phpcs:enable */ ?>
50 <?php endforeach; ?>
51 <?php endif; ?>
52 </select>
53 <?php
54 }
55 ?>
56 <input type="hidden" class="variable_post_id" name="variable_post_id[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( $variation_id ); ?>" />
57 <input type="hidden" class="variation_menu_order" name="variation_menu_order[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( $variation_object->get_menu_order( 'edit' ) ); ?>" />
58
59 <?php
60 /**
61 * Variations header action.
62 *
63 * @since 3.6.0
64 *
65 * @param WP_Post $variation Post data.
66 * @param int $loop Position in the loop.
67 */
68 do_action( 'woocommerce_variation_header', $variation, $loop );
69 ?>
70 </h3>
71 <div class="woocommerce_variable_attributes wc-metabox-content" style="display: none;">
72 <div class="data">
73 <div class="form-flex-box">
74 <div class="form-row upload_image">
75 <a href="#" class="upload_image_button tips <?php echo $variation_object->get_image_id( 'edit' ) ? 'remove' : ''; ?>" data-tip="<?php echo $variation_object->get_image_id( 'edit' ) ? esc_attr__( 'Remove this image', 'woocommerce' ) : esc_attr__( 'Upload an image', 'woocommerce' ); ?>" rel="<?php echo esc_attr( $variation_id ); ?>">
76 <img src="<?php echo $variation_object->get_image_id( 'edit' ) ? esc_url( wp_get_attachment_thumb_url( $variation_object->get_image_id( 'edit' ) ) ) : esc_url( wc_placeholder_img_src() ); ?>" /><input type="hidden" name="upload_image_id[<?php echo esc_attr( $loop ); ?>]" class="upload_image_id" value="<?php echo esc_attr( $variation_object->get_image_id( 'edit' ) ); ?>" />
77 </a>
78 <?php
79 /**
80 * Variation upload image action.
81 *
82 * @since 10.8.0
83 *
84 * @param int $loop Position in the loop.
85 * @param array $variation_data Variation data.
86 * @param WP_Post $variation Post data.
87 */
88 do_action( 'woocommerce_variation_after_upload_image', $loop, $variation_data, $variation );
89 ?>
90 </div>
91 <div class="form-row form-row-last">
92 <?php
93 if ( wc_product_sku_enabled() ) {
94 woocommerce_wp_text_input(
95 array(
96 'id' => "variable_sku{$loop}",
97 'name' => "variable_sku[{$loop}]",
98 'value' => $variation_object->get_sku( 'edit' ),
99 'placeholder' => $variation_object->get_sku(),
100 'label' => '<abbr title="' . esc_attr__( 'Stock Keeping Unit', 'woocommerce' ) . '">' . esc_html__( 'SKU', 'woocommerce' ) . '</abbr>',
101 'desc_tip' => true,
102 'description' => __( 'SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'woocommerce' ),
103 'wrapper_class' => 'form-row',
104 )
105 );
106 }
107 woocommerce_wp_text_input(
108 array(
109 'id' => "variable_global_unique_id{$loop}",
110 'name' => "variable_global_unique_id[{$loop}]",
111 'value' => $variation_object->get_global_unique_id( 'edit' ),
112 'placeholder' => $variation_object->get_global_unique_id(),
113 // translators: %1$s GTIN %2$s UPC %3$s EAN %4$s ISBN.
114 'label' => sprintf( __( '%1$s, %2$s, %3$s, or %4$s', 'woocommerce' ), '<abbr title="' . esc_attr__( 'Global Trade Item Number', 'woocommerce' ) . '">' . esc_html__( 'GTIN', 'woocommerce' ) . '</abbr>', '<abbr title="' . esc_attr__( 'Universal Product Code', 'woocommerce' ) . '">' . esc_html__( 'UPC', 'woocommerce' ) . '</abbr>', '<abbr title="' . esc_attr__( 'European Article Number', 'woocommerce' ) . '">' . esc_html__( 'EAN', 'woocommerce' ) . '</abbr>', '<abbr title="' . esc_attr__( 'International Standard Book Number', 'woocommerce' ) . '">' . esc_html__( 'ISBN', 'woocommerce' ) . '</abbr>' ),
115 'desc_tip' => true,
116 'description' => __( 'Enter a barcode or any other identifier unique to this product. It can help you list this product on other channels or marketplaces.', 'woocommerce' ),
117 'wrapper_class' => 'form-row',
118 )
119 );
120 ?>
121 </div>
122 </div>
123 <p class="form-row form-row-full options">
124 <label>
125 <?php esc_html_e( 'Enabled', 'woocommerce' ); ?>
126 <input type="checkbox" class="checkbox" name="variable_enabled[<?php echo esc_attr( $loop ); ?>]" <?php checked( in_array( $variation_object->get_status( 'edit' ), array( 'publish', false ), true ), true ); ?> />
127 </label>
128 <label class="tips" data-tip="<?php esc_attr_e( 'Enable this option if access is given to a downloadable file upon purchase of a product', 'woocommerce' ); ?>">
129 <?php esc_html_e( 'Downloadable', 'woocommerce' ); ?>
130 <input type="checkbox" class="checkbox variable_is_downloadable" name="variable_is_downloadable[<?php echo esc_attr( $loop ); ?>]" <?php checked( $variation_object->get_downloadable( 'edit' ), true ); ?> />
131 </label>
132 <label class="tips" data-tip="<?php esc_attr_e( 'Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce' ); ?>">
133 <?php esc_html_e( 'Virtual', 'woocommerce' ); ?>
134 <input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php echo esc_attr( $loop ); ?>]" <?php checked( $variation_object->get_virtual( 'edit' ), true ); ?> />
135 </label>
136
137 <?php if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) : ?>
138 <label class="tips" data-tip="<?php esc_attr_e( 'Enable this option to enable stock management at variation level', 'woocommerce' ); ?>">
139 <?php esc_html_e( 'Manage stock?', 'woocommerce' ); ?>
140 <input type="checkbox" class="checkbox variable_manage_stock" name="variable_manage_stock[<?php echo esc_attr( $loop ); ?>]" <?php checked( $variation_object->get_manage_stock(), true ); // Use view context so 'parent' is considered. ?> />
141 </label>
142 <?php endif; ?>
143
144 <?php /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */ ?>
145 <?php do_action( 'woocommerce_variation_options', $loop, $variation_data, $variation ); ?>
146 <?php /* phpcs:enable */ ?>
147 </p>
148
149 <div class="variable_pricing">
150 <?php
151
152 $tax_label = '';
153 if ( wc_tax_enabled() ) {
154 $tax_text = wc_prices_include_tax()
155 ? __( 'incl. tax', 'woocommerce' )
156 : __( 'ex. tax', 'woocommerce' );
157 $tax_label = ' (' . $tax_text . ')';
158 }
159
160 $label = sprintf(
161 /* translators: 1: currency symbol, 2: tax label (prefixed with space if present) */
162 __( 'Regular price (%1$s%2$s)', 'woocommerce' ),
163 get_woocommerce_currency_symbol(),
164 $tax_label ? ' ' . $tax_label : ''
165 );
166
167 woocommerce_wp_text_input(
168 array(
169 'id' => "variable_regular_price_{$loop}",
170 'name' => "variable_regular_price[{$loop}]",
171 'value' => wc_format_localized_price( $variation_object->get_regular_price( 'edit' ) ),
172 'label' => $label,
173 'data_type' => 'price',
174 'wrapper_class' => 'form-row form-row-first',
175 'placeholder' => __( 'Variation price (required)', 'woocommerce' ),
176 )
177 );
178
179 $label = sprintf(
180 /* translators: 1: currency symbol, 2: tax label (prefixed with space if present) */
181 __( 'Sale price (%1$s%2$s)', 'woocommerce' ),
182 get_woocommerce_currency_symbol(),
183 $tax_label ? ' ' . $tax_label : ''
184 );
185
186 woocommerce_wp_text_input(
187 array(
188 'id' => "variable_sale_price{$loop}",
189 'name' => "variable_sale_price[{$loop}]",
190 'value' => wc_format_localized_price( $variation_object->get_sale_price( 'edit' ) ),
191 'data_type' => 'price',
192 'label' => $label . ' <a href="#" class="sale_schedule">' . esc_html__( 'Schedule', 'woocommerce' ) . '</a><a href="#" class="cancel_sale_schedule hidden">' . esc_html__( 'Cancel schedule', 'woocommerce' ) . '</a>',
193 'wrapper_class' => 'form-row form-row-last',
194 )
195 );
196
197 $sale_price_dates_from_timestamp = $variation_object->get_date_on_sale_from( 'edit' ) ? $variation_object->get_date_on_sale_from( 'edit' )->getOffsetTimestamp() : false;
198 $sale_price_dates_to_timestamp = $variation_object->get_date_on_sale_to( 'edit' ) ? $variation_object->get_date_on_sale_to( 'edit' )->getOffsetTimestamp() : false;
199
200 $sale_price_dates_from = $sale_price_dates_from_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_from_timestamp ) : '';
201 $sale_price_dates_to = $sale_price_dates_to_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_to_timestamp ) : '';
202
203 /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */
204 echo '<div class="form-field sale_price_dates_fields hidden">
205 <p class="form-row form-row-first">
206 <label>' . esc_html__( 'Sale start date', 'woocommerce' ) . '</label>
207 <input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[' . esc_attr( $loop ) . ']" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . esc_attr_x( 'From&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
208 </p>
209 <p class="form-row form-row-last">
210 <label>' . esc_html__( 'Sale end date', 'woocommerce' ) . '</label>
211 <input type="text" class="sale_price_dates_to" name="variable_sale_price_dates_to[' . esc_attr( $loop ) . ']" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . esc_attr_x( 'To&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
212 </p>
213 </div>';
214 /* phpcs: enable */
215
216 /**
217 * Variation options pricing action.
218 *
219 * @since 2.5.0
220 *
221 * @param int $loop Position in the loop.
222 * @param array $variation_data Variation data.
223 * @param WP_Post $variation Post data.
224 */
225 do_action( 'woocommerce_variation_options_pricing', $loop, $variation_data, $variation );
226 ?>
227 </div>
228
229 <?php if ( ! is_null( $base_cost ) ) : ?>
230 <div class="variable_pricing">
231 <?php
232 $label = sprintf(
233 /* translators: %s: currency symbol */
234 __( 'Cost (%s)', 'woocommerce' ),
235 get_woocommerce_currency_symbol()
236 );
237
238 $variation_cogs = $variation_object->get_cogs_value();
239 woocommerce_wp_text_input(
240 array(
241 'id' => "variable_cost_value_{$loop}",
242 'name' => "variable_cost_value[{$loop}]",
243 'value' => is_null( $variation_cogs ) ? '' : wc_format_localized_price( $variation_cogs ),
244 'label' => $label,
245 'data_type' => 'price',
246 'wrapper_class' => 'form-row form-row-first variation-cost-field',
247 'description_hidden' => ! is_null( $variation_cogs ),
248 'description' => array(
249 __( 'Add the amount it costs you to buy or make this product. Leave blank to use the default value from "General".', 'woocommerce' ),
250 __( 'You can specify a <a href="#" class="switch-to-general-tab">default value</a> for all variations', 'woocommerce' ),
251 ),
252 'placeholder' =>
253 /* Translators: %s = cost of the item (monetary value) */
254 sprintf( __( '%s (default)', 'woocommerce' ), wc_format_localized_price( $base_cost ) ),
255 )
256 );
257 ?>
258 </div>
259 <?php endif; ?>
260
261 <?php if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) : ?>
262 <div class="show_if_variation_manage_stock form-row form-row-full" style="display: none;">
263 <?php
264 woocommerce_wp_text_input(
265 array(
266 'id' => "variable_stock{$loop}",
267 'name' => "variable_stock[{$loop}]",
268 'value' => wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ),
269 'label' => __( 'Stock quantity', 'woocommerce' ),
270 'desc_tip' => true,
271 'description' => __( "Enter a number to set stock quantity at the variation level. Use a variation's 'Manage stock?' check box above to enable/disable stock management at the variation level.", 'woocommerce' ),
272 'type' => 'number',
273 'custom_attributes' => array(
274 'step' => 'any',
275 ),
276 'data_type' => 'stock',
277 'wrapper_class' => 'form-row form-row-first',
278 )
279 );
280
281 echo '<input type="hidden" name="variable_original_stock[' . esc_attr( $loop ) . ']" value="' . esc_attr( wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ) ) . '" />';
282
283 woocommerce_wp_select(
284 array(
285 'id' => "variable_backorders{$loop}",
286 'name' => "variable_backorders[{$loop}]",
287 'value' => $variation_object->get_backorders( 'edit' ),
288 'label' => __( 'Allow backorders?', 'woocommerce' ),
289 'options' => wc_get_product_backorder_options(),
290 'desc_tip' => true,
291 'description' => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce' ),
292 'wrapper_class' => 'form-row form-row-last',
293 )
294 );
295
296 $low_stock_placeholder = ( $product_object->get_manage_stock() && '' !== $product_object->get_low_stock_amount() )
297 ? sprintf(
298 /* translators: %d: Amount of stock left */
299 esc_attr__( 'Parent product\'s threshold (%d)', 'woocommerce' ),
300 esc_attr( $product_object->get_low_stock_amount() )
301 )
302 : sprintf(
303 /* translators: %d: Amount of stock left */
304 esc_attr__( 'Store-wide threshold (%d)', 'woocommerce' ),
305 esc_attr( get_option( 'woocommerce_notify_low_stock_amount' ) )
306 );
307
308 woocommerce_wp_text_input(
309 array(
310 'id' => "variable_low_stock_amount{$loop}",
311 'name' => "variable_low_stock_amount[{$loop}]",
312 'value' => $variation_object->get_low_stock_amount( 'edit' ),
313 'placeholder' => $low_stock_placeholder,
314 'label' => __( 'Low stock threshold', 'woocommerce' ),
315 'desc_tip' => true,
316 'description' => __( 'When variation stock reaches this amount you will be notified by email. The default value for all variations can be set in the product Inventory tab. The shop default value can be set in Settings > Products > Inventory.', 'woocommerce' ),
317 'type' => 'number',
318 'custom_attributes' => array(
319 'step' => 'any',
320 ),
321 'wrapper_class' => 'form-row',
322 )
323 );
324
325 /**
326 * Variation options inventory action.
327 *
328 * @since 2.5.0
329 *
330 * @param int $loop Position in the loop.
331 * @param array $variation_data Variation data.
332 * @param WP_Post $variation Post data.
333 */
334 do_action( 'woocommerce_variation_options_inventory', $loop, $variation_data, $variation );
335 ?>
336 </div>
337 <?php endif; ?>
338
339 <div>
340 <?php
341 woocommerce_wp_select(
342 array(
343 'id' => "variable_stock_status{$loop}",
344 'name' => "variable_stock_status[{$loop}]",
345 'value' => $variation_object->get_stock_status( 'edit' ),
346 'label' => __( 'Stock status', 'woocommerce' ),
347 'options' => wc_get_product_stock_status_options(),
348 'desc_tip' => true,
349 'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ),
350 'wrapper_class' => 'form-row form-row-full variable_stock_status',
351 )
352 );
353
354 if ( wc_product_weight_enabled() ) {
355 $label = sprintf(
356 /* translators: %s: Weight unit */
357 __( 'Weight (%s)', 'woocommerce' ),
358 I18nUtil::get_weight_unit_label( get_option( 'woocommerce_weight_unit', 'kg' ) )
359 );
360
361 woocommerce_wp_text_input(
362 array(
363 'id' => "variable_weight{$loop}",
364 'name' => "variable_weight[{$loop}]",
365 'value' => wc_format_localized_decimal( $variation_object->get_weight( 'edit' ) ),
366 'placeholder' => wc_format_localized_decimal( $product_object->get_weight() ),
367 'label' => $label,
368 'desc_tip' => true,
369 'description' => __( 'Weight in decimal form', 'woocommerce' ),
370 'type' => 'text',
371 'data_type' => 'decimal',
372 'wrapper_class' => 'form-row form-row-first hide_if_variation_virtual',
373 )
374 );
375 }
376
377 if ( wc_product_dimensions_enabled() ) {
378 $parent_length = wc_format_localized_decimal( $product_object->get_length() );
379 $parent_width = wc_format_localized_decimal( $product_object->get_width() );
380 $parent_height = wc_format_localized_decimal( $product_object->get_height() );
381
382 ?>
383 <p class="form-field form-row dimensions_field hide_if_variation_virtual form-row-last">
384 <label for="product_length">
385 <?php
386 printf(
387 /* translators: %s dimension unit */
388 esc_html__( 'Dimensions (L&times;W&times;H) (%s)', 'woocommerce' ),
389 esc_html( I18nUtil::get_dimensions_unit_label( get_option( 'woocommerce_dimension_unit' ) ) )
390 );
391 ?>
392 </label>
393 <?php echo wc_help_tip( __( 'Length x width x height in decimal form', 'woocommerce' ) ); ?>
394 <span class="wrap">
395 <input id="product_length" placeholder="<?php echo $parent_length ? esc_attr( $parent_length ) : esc_attr__( 'Length', 'woocommerce' ); ?>" class="input-text wc_input_decimal" size="6" type="text" name="variable_length[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( wc_format_localized_decimal( $variation_object->get_length( 'edit' ) ) ); ?>" />
396 <input placeholder="<?php echo $parent_width ? esc_attr( $parent_width ) : esc_attr__( 'Width', 'woocommerce' ); ?>" class="input-text wc_input_decimal" size="6" type="text" name="variable_width[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( wc_format_localized_decimal( $variation_object->get_width( 'edit' ) ) ); ?>" />
397 <input placeholder="<?php echo $parent_height ? esc_attr( $parent_height ) : esc_attr__( 'Height', 'woocommerce' ); ?>" class="input-text wc_input_decimal last" size="6" type="text" name="variable_height[<?php echo esc_attr( $loop ); ?>]" value="<?php echo esc_attr( wc_format_localized_decimal( $variation_object->get_height( 'edit' ) ) ); ?>" />
398 </span>
399 </p>
400 <?php
401 }
402
403 /**
404 * Variation options dimensions action.
405 *
406 * @since 2.5.0
407 *
408 * @param int $loop Position in the loop.
409 * @param array $variation_data Variation data.
410 * @param WP_Post $variation Post data.
411 */
412 do_action( 'woocommerce_variation_options_dimensions', $loop, $variation_data, $variation );
413 ?>
414 </div>
415
416 <div>
417 <p class="form-row hide_if_variation_virtual form-row-full">
418 <label><?php esc_html_e( 'Shipping class', 'woocommerce' ); ?></label>
419 <?php
420 wp_dropdown_categories(
421 array(
422 'taxonomy' => 'product_shipping_class',
423 'hide_empty' => 0,
424 'show_option_none' => __( 'Same as parent', 'woocommerce' ),
425 'name' => 'variable_shipping_class[' . $loop . ']',
426 'id' => '',
427 'selected' => $variation_object->get_shipping_class_id( 'edit' ),
428 )
429 );
430 ?>
431 </p>
432
433 <?php
434 if ( wc_tax_enabled() ) {
435 woocommerce_wp_select(
436 array(
437 'id' => "variable_tax_class{$loop}",
438 'name' => "variable_tax_class[{$loop}]",
439 'value' => $variation_object->get_tax_class( 'edit' ),
440 'label' => __( 'Tax class', 'woocommerce' ),
441 'options' => array( 'parent' => __( 'Same as parent', 'woocommerce' ) ) + wc_get_product_tax_class_options(),
442 'desc_tip' => 'true',
443 'description' => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' ),
444 'wrapper_class' => 'form-row form-row-full',
445 )
446 );
447
448 /**
449 * Variation options tax action.
450 *
451 * @since 2.5.0
452 *
453 * @param int $loop Position in the loop.
454 * @param array $variation_data Variation data.
455 * @param WP_Post $variation Post data.
456 */
457 do_action( 'woocommerce_variation_options_tax', $loop, $variation_data, $variation );
458 }
459 ?>
460 </div>
461 <div>
462 <?php
463 woocommerce_wp_textarea_input(
464 array(
465 'id' => "variable_description{$loop}",
466 'name' => "variable_description[{$loop}]",
467 'value' => $variation_object->get_description( 'edit' ),
468 'label' => __( 'Description', 'woocommerce' ),
469 'desc_tip' => true,
470 'description' => __( 'Enter an optional description for this variation.', 'woocommerce' ),
471 'wrapper_class' => 'form-row form-row-full',
472 )
473 );
474 ?>
475 </div>
476 <div class="show_if_variation_downloadable" style="display: none;">
477 <div class="form-row form-row-full downloadable_files">
478 <label><?php esc_html_e( 'Downloadable files', 'woocommerce' ); ?></label>
479 <table class="widefat">
480 <thead>
481 <div>
482 <th><?php esc_html_e( 'Name', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'This is the name of the download shown to the customer.', 'woocommerce' ) ); ?></th>
483 <th colspan="2"><?php esc_html_e( 'File URL', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'This is the URL or absolute path to the file which customers will get access to. URLs entered here should already be encoded.', 'woocommerce' ) ); ?></th>
484 <th>&nbsp;</th>
485 </div>
486 </thead>
487 <tbody>
488 <?php
489 $downloadable_files = $variation_object->get_downloads( 'edit' );
490 $disabled_downloads_count = 0;
491
492 if ( $downloadable_files ) {
493 foreach ( $downloadable_files as $key => $file ) {
494 $disabled_download = isset( $file['enabled'] ) && false === $file['enabled'];
495 $disabled_downloads_count += (int) $disabled_download;
496 include __DIR__ . '/html-product-variation-download.php';
497 }
498 }
499 ?>
500 </tbody>
501 <tfoot>
502 <div>
503 <th colspan="1">
504 <a href="#" class="button insert" data-row="
505 <?php
506 $key = '';
507 $file = array(
508 'file' => '',
509 'name' => '',
510 );
511 $disabled_download = false;
512 ob_start();
513 require __DIR__ . '/html-product-variation-download.php';
514 echo esc_attr( ob_get_clean() );
515 ?>
516 "><?php esc_html_e( 'Add file', 'woocommerce' ); ?></a>
517 </th>
518 <th colspan="3">
519 <?php if ( $disabled_downloads_count ) : ?>
520 <span class="disabled">*</span>
521 <?php
522 printf(
523 /* translators: 1: opening link tag, 2: closing link tag. */
524 esc_html__( 'The indicated downloads have been disabled (invalid location or filetype&mdash;%1$slearn more%2$s).', 'woocommerce' ),
525 '<a href="https://woocommerce.com/document/approved-download-directories" target="_blank">',
526 '</a>'
527 );
528 ?>
529 <?php endif; ?>
530 </th>
531 </div>
532 </tfoot>
533 </table>
534 </div>
535 </div>
536 <div class="show_if_variation_downloadable" style="display: none;">
537 <?php
538 woocommerce_wp_text_input(
539 array(
540 'id' => "variable_download_limit{$loop}",
541 'name' => "variable_download_limit[{$loop}]",
542 'value' => $variation_object->get_download_limit( 'edit' ) < 0 ? '' : $variation_object->get_download_limit( 'edit' ),
543 'label' => __( 'Download limit', 'woocommerce' ),
544 'placeholder' => __( 'Unlimited', 'woocommerce' ),
545 'description' => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ),
546 'type' => 'number',
547 'desc_tip' => true,
548 'custom_attributes' => array(
549 'step' => '1',
550 'min' => '0',
551 ),
552 'wrapper_class' => 'form-row form-row-first',
553 )
554 );
555
556 woocommerce_wp_text_input(
557 array(
558 'id' => "variable_download_expiry{$loop}",
559 'name' => "variable_download_expiry[{$loop}]",
560 'value' => $variation_object->get_download_expiry( 'edit' ) < 0 ? '' : $variation_object->get_download_expiry( 'edit' ),
561 'label' => __( 'Download expiry', 'woocommerce' ),
562 'placeholder' => __( 'Never', 'woocommerce' ),
563 'description' => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ),
564 'type' => 'number',
565 'desc_tip' => true,
566 'custom_attributes' => array(
567 'step' => '1',
568 'min' => '0',
569 ),
570 'wrapper_class' => 'form-row form-row-last',
571 )
572 );
573
574 /**
575 * Variation options download action.
576 *
577 * @since 2.5.0
578 *
579 * @param int $loop Position in the loop.
580 * @param array $variation_data Variation data.
581 * @param WP_Post $variation Post data.
582 */
583 do_action( 'woocommerce_variation_options_download', $loop, $variation_data, $variation );
584 ?>
585 </div>
586 <?php /* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */ ?>
587 <?php do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation ); ?>
588 <?php /* phpcs:enable */ ?>
589 </div>
590 </div>
591 </div>
592