Merged in release/release-1.09 (pull request #10)
Release/release 1.09 * Install missing plugins * rs set to 1 * rebase pantheon for aws * rebase pantheon for aws * prod config change * prod config change * fix campaing issue * revert Approved-by: Jay Sharma
This commit is contained in:
committed by
Jay Sharma
parent
779393381f
commit
22f10a9edd
@@ -83,61 +83,38 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
|
||||
add_action( 'admin_footer', array( 'WC_Shipping_Free_Shipping', 'enqueue_admin_js' ), 10 ); // Priority needs to be higher than wc_print_js (25).
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize the cost field.
|
||||
*
|
||||
* @since 8.3.0
|
||||
* @param string $value Unsanitized value.
|
||||
* @throws Exception Last error triggered.
|
||||
* @return string
|
||||
*/
|
||||
public function sanitize_cost( $value ) {
|
||||
$value = is_null( $value ) ? '' : $value;
|
||||
$value = wp_kses_post( trim( wp_unslash( $value ) ) );
|
||||
$value = str_replace( array( get_woocommerce_currency_symbol(), html_entity_decode( get_woocommerce_currency_symbol() ), wc_get_price_thousand_separator() ), '', $value );
|
||||
|
||||
if ( ! is_numeric( $value ) ) {
|
||||
throw new Exception( __( 'Please enter a valid number', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init form fields.
|
||||
*/
|
||||
public function init_form_fields() {
|
||||
$this->instance_form_fields = array(
|
||||
'title' => array(
|
||||
'title' => __( 'Name', 'woocommerce' ),
|
||||
'title' => __( 'Title', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Your customers will see the name of this shipping method during checkout.', 'woocommerce' ),
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'default' => $this->method_title,
|
||||
'placeholder' => __( 'e.g. Free shipping', 'woocommerce' ),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
'requires' => array(
|
||||
'title' => __( 'Free shipping requires', 'woocommerce' ),
|
||||
'title' => __( 'Free shipping requires...', 'woocommerce' ),
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'default' => '',
|
||||
'options' => array(
|
||||
'' => __( 'No requirement', 'woocommerce' ),
|
||||
'' => __( 'N/A', 'woocommerce' ),
|
||||
'coupon' => __( 'A valid free shipping coupon', 'woocommerce' ),
|
||||
'min_amount' => __( 'A minimum order amount', 'woocommerce' ),
|
||||
'either' => __( 'A minimum order amount OR coupon', 'woocommerce' ),
|
||||
'both' => __( 'A minimum order amount AND coupon', 'woocommerce' ),
|
||||
'either' => __( 'A minimum order amount OR a coupon', 'woocommerce' ),
|
||||
'both' => __( 'A minimum order amount AND a coupon', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'min_amount' => array(
|
||||
'title' => __( 'Minimum order amount', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'class' => 'wc-shipping-modal-price',
|
||||
'placeholder' => wc_format_localized_price( 0 ),
|
||||
'description' => __( 'Customers will need to spend this amount to get free shipping.', 'woocommerce' ),
|
||||
'default' => '0',
|
||||
'desc_tip' => true,
|
||||
'sanitize_callback' => array( $this, 'sanitize_cost' ),
|
||||
'title' => __( 'Minimum order amount', 'woocommerce' ),
|
||||
'type' => 'price',
|
||||
'placeholder' => wc_format_localized_price( 0 ),
|
||||
'description' => __( 'Users will need to spend this amount to get free shipping (if enabled above).', 'woocommerce' ),
|
||||
'default' => '0',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
'ignore_discounts' => array(
|
||||
'title' => __( 'Coupons discounts', 'woocommerce' ),
|
||||
|
||||
Reference in New Issue
Block a user