"variable_sku{$loop}",
'name' => "variable_sku[{$loop}]",
'value' => $variation_object->get_sku( 'edit' ),
'placeholder' => $variation_object->get_sku(),
'label' => '
' . esc_html__( 'SKU', 'woocommerce' ) . '',
'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' ),
'wrapper_class' => 'form-row form-row-last',
)
);
}
?>
"variable_regular_price_{$loop}",
'name' => "variable_regular_price[{$loop}]",
'value' => wc_format_localized_price( $variation_object->get_regular_price( 'edit' ) ),
'label' => $label,
'data_type' => 'price',
'wrapper_class' => 'form-row form-row-first',
'placeholder' => __( 'Variation price (required)', 'woocommerce' ),
)
);
$label = sprintf(
/* translators: %s: currency symbol */
__( 'Sale price (%s)', 'woocommerce' ),
get_woocommerce_currency_symbol()
);
woocommerce_wp_text_input(
array(
'id' => "variable_sale_price{$loop}",
'name' => "variable_sale_price[{$loop}]",
'value' => wc_format_localized_price( $variation_object->get_sale_price( 'edit' ) ),
'data_type' => 'price',
'label' => $label . '
' . esc_html__( 'Schedule', 'woocommerce' ) . '' . esc_html__( 'Cancel schedule', 'woocommerce' ) . '',
'wrapper_class' => 'form-row form-row-last',
)
);
$sale_price_dates_from_timestamp = $variation_object->get_date_on_sale_from( 'edit' ) ? $variation_object->get_date_on_sale_from( 'edit' )->getOffsetTimestamp() : false;
$sale_price_dates_to_timestamp = $variation_object->get_date_on_sale_to( 'edit' ) ? $variation_object->get_date_on_sale_to( 'edit' )->getOffsetTimestamp() : false;
$sale_price_dates_from = $sale_price_dates_from_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_from_timestamp ) : '';
$sale_price_dates_to = $sale_price_dates_to_timestamp ? date_i18n( 'Y-m-d', $sale_price_dates_to_timestamp ) : '';
echo '
';
/**
* Variation options pricing action.
*
* @since 2.5.0
*
* @param int $loop Position in the loop.
* @param array $variation_data Variation data.
* @param WP_Post $variation Post data.
*/
do_action( 'woocommerce_variation_options_pricing', $loop, $variation_data, $variation );
?>
"variable_stock{$loop}",
'name' => "variable_stock[{$loop}]",
'value' => wc_stock_amount( $variation_object->get_stock_quantity( 'edit' ) ),
'label' => __( 'Stock quantity', 'woocommerce' ),
'desc_tip' => true,
'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' ),
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
),
'data_type' => 'stock',
'wrapper_class' => 'form-row form-row-first',
)
);
echo '';
woocommerce_wp_select(
array(
'id' => "variable_backorders{$loop}",
'name' => "variable_backorders[{$loop}]",
'value' => $variation_object->get_backorders( 'edit' ),
'label' => __( 'Allow backorders?', 'woocommerce' ),
'options' => wc_get_product_backorder_options(),
'desc_tip' => true,
'description' => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'woocommerce' ),
'wrapper_class' => 'form-row form-row-last',
)
);
$low_stock_placeholder = ( $product_object->get_manage_stock() && '' !== $product_object->get_low_stock_amount() )
? sprintf(
/* translators: %d: Amount of stock left */
esc_attr__( 'Parent product\'s threshold (%d)', 'woocommerce' ),
esc_attr( $product_object->get_low_stock_amount() )
)
: sprintf(
/* translators: %d: Amount of stock left */
esc_attr__( 'Store-wide threshold (%d)', 'woocommerce' ),
esc_attr( get_option( 'woocommerce_notify_low_stock_amount' ) )
);
woocommerce_wp_text_input(
array(
'id' => "variable_low_stock_amount{$loop}",
'name' => "variable_low_stock_amount[{$loop}]",
'value' => $variation_object->get_low_stock_amount( 'edit' ),
'placeholder' => $low_stock_placeholder,
'label' => __( 'Low stock threshold', 'woocommerce' ),
'desc_tip' => true,
'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' ),
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
),
'wrapper_class' => 'form-row',
)
);
/**
* Variation options inventory action.
*
* @since 2.5.0
*
* @param int $loop Position in the loop.
* @param array $variation_data Variation data.
* @param WP_Post $variation Post data.
*/
do_action( 'woocommerce_variation_options_inventory', $loop, $variation_data, $variation );
?>
"variable_stock_status{$loop}",
'name' => "variable_stock_status[{$loop}]",
'value' => $variation_object->get_stock_status( 'edit' ),
'label' => __( 'Stock status', 'woocommerce' ),
'options' => wc_get_product_stock_status_options(),
'desc_tip' => true,
'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ),
'wrapper_class' => 'form-row form-row-full variable_stock_status',
)
);
if ( wc_product_weight_enabled() ) {
$label = sprintf(
/* translators: %s: weight unit */
__( 'Weight (%s)', 'woocommerce' ),
esc_html( get_option( 'woocommerce_weight_unit' ) )
);
woocommerce_wp_text_input(
array(
'id' => "variable_weight{$loop}",
'name' => "variable_weight[{$loop}]",
'value' => wc_format_localized_decimal( $variation_object->get_weight( 'edit' ) ),
'placeholder' => wc_format_localized_decimal( $product_object->get_weight() ),
'label' => $label,
'desc_tip' => true,
'description' => __( 'Weight in decimal form', 'woocommerce' ),
'type' => 'text',
'data_type' => 'decimal',
'wrapper_class' => 'form-row form-row-first hide_if_variation_virtual',
)
);
}
if ( wc_product_dimensions_enabled() ) {
$parent_length = wc_format_localized_decimal( $product_object->get_length() );
$parent_width = wc_format_localized_decimal( $product_object->get_width() );
$parent_height = wc_format_localized_decimal( $product_object->get_height() );
?>
'product_shipping_class',
'hide_empty' => 0,
'show_option_none' => __( 'Same as parent', 'woocommerce' ),
'name' => 'variable_shipping_class[' . $loop . ']',
'id' => '',
'selected' => $variation_object->get_shipping_class_id( 'edit' ),
)
);
?>
"variable_tax_class{$loop}",
'name' => "variable_tax_class[{$loop}]",
'value' => $variation_object->get_tax_class( 'edit' ),
'label' => __( 'Tax class', 'woocommerce' ),
'options' => array( 'parent' => __( 'Same as parent', 'woocommerce' ) ) + wc_get_product_tax_class_options(),
'desc_tip' => 'true',
'description' => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' ),
'wrapper_class' => 'form-row form-row-full',
)
);
/**
* Variation options tax action.
*
* @since 2.5.0
*
* @param int $loop Position in the loop.
* @param array $variation_data Variation data.
* @param WP_Post $variation Post data.
*/
do_action( 'woocommerce_variation_options_tax', $loop, $variation_data, $variation );
}
?>
"variable_description{$loop}",
'name' => "variable_description[{$loop}]",
'value' => $variation_object->get_description( 'edit' ),
'label' => __( 'Description', 'woocommerce' ),
'desc_tip' => true,
'description' => __( 'Enter an optional description for this variation.', 'woocommerce' ),
'wrapper_class' => 'form-row form-row-full',
)
);
?>
"variable_download_limit{$loop}",
'name' => "variable_download_limit[{$loop}]",
'value' => $variation_object->get_download_limit( 'edit' ) < 0 ? '' : $variation_object->get_download_limit( 'edit' ),
'label' => __( 'Download limit', 'woocommerce' ),
'placeholder' => __( 'Unlimited', 'woocommerce' ),
'description' => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ),
'type' => 'number',
'desc_tip' => true,
'custom_attributes' => array(
'step' => '1',
'min' => '0',
),
'wrapper_class' => 'form-row form-row-first',
)
);
woocommerce_wp_text_input(
array(
'id' => "variable_download_expiry{$loop}",
'name' => "variable_download_expiry[{$loop}]",
'value' => $variation_object->get_download_expiry( 'edit' ) < 0 ? '' : $variation_object->get_download_expiry( 'edit' ),
'label' => __( 'Download expiry', 'woocommerce' ),
'placeholder' => __( 'Never', 'woocommerce' ),
'description' => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ),
'type' => 'number',
'desc_tip' => true,
'custom_attributes' => array(
'step' => '1',
'min' => '0',
),
'wrapper_class' => 'form-row form-row-last',
)
);
/**
* Variation options download action.
*
* @since 2.5.0
*
* @param int $loop Position in the loop.
* @param array $variation_data Variation data.
* @param WP_Post $variation Post data.
*/
do_action( 'woocommerce_variation_options_download', $loop, $variation_data, $variation );
?>