Update checked functionality to use a filter, removed option from settings screen. Can use the woocommerce_restock_refunded_items filter to have the option checked or not, defaults to unchecked.

This commit is contained in:
Gerhard Potgieter 2018-09-10 11:31:24 +02:00
parent 9b07180c7a
commit e3994348b3
2 changed files with 5 additions and 11 deletions

View File

@ -254,11 +254,13 @@ if ( wc_tax_enabled() ) {
<tr> <tr>
<td class="label"><label for="restock_refunded_items"><?php esc_html_e( 'Restock refunded items', 'woocommerce' ); ?>:</label></td> <td class="label"><label for="restock_refunded_items"><?php esc_html_e( 'Restock refunded items', 'woocommerce' ); ?>:</label></td>
<?php <?php
if ( 'yes' === get_option( 'woocommerce_restock_refunded_items' ) ) { if ( apply_filter( 'woocommerce_restock_refunded_items', false ) ) {
$checked = 'checked="checked"'; $checked = 1;
} else {
$checked = 0;
} }
?> ?>
<td class="total"><input type="checkbox" id="restock_refunded_items" name="restock_refunded_items"<?php echo esc_attr( $checked, 'woocommerce' ); ?> /></td> <td class="total"><input type="checkbox" id="restock_refunded_items" name="restock_refunded_items"<?php checked( 1, $checked, true ); ?> /></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<tr> <tr>

View File

@ -139,14 +139,6 @@ class WC_Settings_Products extends WC_Settings_Page {
'type' => 'checkbox', 'type' => 'checkbox',
), ),
array(
'title' => __( 'Restock refunded items', 'woocommerce' ),
'desc' => __( 'Uncheck this to default to NOT restocking items when refunding', 'woocommerce' ),
'id' => 'woocommerce_restock_refunded_items',
'default' => 'yes',
'type' => 'checkbox',
),
array( array(
'title' => __( 'Hold stock (minutes)', 'woocommerce' ), 'title' => __( 'Hold stock (minutes)', 'woocommerce' ),
'desc' => __( 'Hold stock (for unpaid orders) for x minutes. When this limit is reached, the pending order will be cancelled. Leave blank to disable.', 'woocommerce' ), 'desc' => __( 'Hold stock (for unpaid orders) for x minutes. When this limit is reached, the pending order will be cancelled. Leave blank to disable.', 'woocommerce' ),