id = '';
$this->desc = __( 'General', 'left-to-free-shipping-for-woocommerce' );
parent::__construct();
add_action( 'woocommerce_admin_field_alg_wc_alfs__custom_textarea', array( $this, 'output_custom_textarea' ) );
add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'unclean_custom_textarea' ), PHP_INT_MAX, 3 );
}
/**
* unclean_custom_textarea.
*
* @version 1.1.0
* @since 1.1.0
*/
function unclean_custom_textarea( $value, $option, $raw_value ) {
return ( 'alg_wc_alfs__custom_textarea' === $option['type'] ) ? $raw_value : $value;
}
/**
* output_custom_textarea.
*
* @version 1.1.0
* @since 1.1.0
*/
function output_custom_textarea( $value ) {
$option_value = get_option( $value['id'], $value['default'] );
$custom_attributes = ( isset( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) ? $value['custom_attributes'] : array();
$description = '
' . $value['desc'] . '
';
$tooltip_html = ( isset( $value['desc_tip'] ) && '' != $value['desc_tip'] ) ? ' ' : '';
// Output
?>
__( 'Amount Left for Free Shipping Options', 'left-to-free-shipping-for-woocommerce' ),
'type' => 'title',
'id' => 'alg_wc_left_to_free_shipping_options',
),
array(
'title' => __( 'Amount Left for Free Shipping', 'left-to-free-shipping-for-woocommerce' ),
'desc' => '' . __( 'Enable', 'left-to-free-shipping-for-woocommerce' ) . ' ',
'desc_tip' => __( 'WooCommerce Amount Left for Free Shipping.', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_enabled',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'type' => 'sectionend',
'id' => 'alg_wc_left_to_free_shipping_options',
),
array(
'title' => __( 'Amount Left for Free Shipping Info Options', 'left-to-free-shipping-for-woocommerce' ),
'type' => 'title',
'desc' => '' .
'' .
__( 'Here you enable info on cart, mini cart and checkout pages.', 'left-to-free-shipping-for-woocommerce' ) .
' ' .
'' .
sprintf( __( 'Values that will be replaced in "Content": %s', 'left-to-free-shipping-for-woocommerce' ),
'%amount_left_for_free_shipping%, %free_shipping_min_amount%.' ) .
' ' .
' ' .
'' . __( 'Alternatively you can use:', 'left-to-free-shipping-for-woocommerce' ) . ' ' .
'' .
'' .
'' . __( 'Widget', 'left-to-free-shipping-for-woocommerce' ) . ' ' . ': ' .
'' . __( 'Amount Left for Free Shipping', 'left-to-free-shipping-for-woocommerce' ) . ' ' .
' ' .
'' .
'' . __( 'Shortcode', 'left-to-free-shipping-for-woocommerce' ) . ' ' . ': ' .
'[alg_get_left_to_free_shipping content="%amount_left_for_free_shipping% left for free shipping"]' .
' ' .
'' .
'' . __( 'PHP function', 'left-to-free-shipping-for-woocommerce' ) . ' ' . ': ' .
'alg_get_left_to_free_shipping( "%amount_left_for_free_shipping% left for free shipping" );' .
' ' .
' ',
'id' => 'alg_wc_left_to_free_shipping_info_options',
),
array(
'title' => __( 'Info on Cart', 'left-to-free-shipping-for-woocommerce' ),
'desc' => __( 'Enable', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_enabled_cart',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => '',
'desc' => __( 'Content', 'left-to-free-shipping-for-woocommerce' ),
'desc_tip' => __( 'You can use HTML here.', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_content_cart',
'default' => __( '%amount_left_for_free_shipping% left for free shipping', 'left-to-free-shipping-for-woocommerce' ),
'type' => 'alg_wc_alfs__custom_textarea',
'css' => 'width:30%;min-width:300px;height:100px;',
),
array(
'title' => '',
'desc' => __( 'Position', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_position_cart',
'default' => 'woocommerce_after_cart_totals',
'type' => 'select',
'options' => array(
'woocommerce_before_cart' => __( 'Before cart', 'woocommerce-jetpack' ),
'woocommerce_before_cart_table' => __( 'Before cart table', 'woocommerce-jetpack' ),
'woocommerce_before_cart_contents' => __( 'Before cart contents', 'woocommerce-jetpack' ),
'woocommerce_cart_contents' => __( 'Cart contents', 'woocommerce-jetpack' ),
'woocommerce_cart_coupon' => __( 'Cart coupon', 'woocommerce-jetpack' ),
'woocommerce_cart_actions' => __( 'Cart actions', 'woocommerce-jetpack' ),
'woocommerce_after_cart_contents' => __( 'After cart contents', 'woocommerce-jetpack' ),
'woocommerce_after_cart_table' => __( 'After cart table', 'woocommerce-jetpack' ),
'woocommerce_cart_collaterals' => __( 'Cart collaterals', 'woocommerce-jetpack' ),
'woocommerce_after_cart' => __( 'After cart', 'woocommerce-jetpack' ),
'woocommerce_before_cart_totals' => __( 'Before cart totals', 'woocommerce-jetpack' ),
'woocommerce_cart_totals_before_shipping' => __( 'Cart totals: Before shipping', 'woocommerce-jetpack' ),
'woocommerce_cart_totals_after_shipping' => __( 'Cart totals: After shipping', 'woocommerce-jetpack' ),
'woocommerce_cart_totals_before_order_total' => __( 'Cart totals: Before order total', 'woocommerce-jetpack' ),
'woocommerce_cart_totals_after_order_total' => __( 'Cart totals: After order total', 'woocommerce-jetpack' ),
'woocommerce_proceed_to_checkout' => __( 'Proceed to checkout', 'woocommerce-jetpack' ),
'woocommerce_after_cart_totals' => __( 'After cart totals', 'woocommerce-jetpack' ),
'woocommerce_before_shipping_calculator' => __( 'Before shipping calculator', 'woocommerce-jetpack' ),
'woocommerce_after_shipping_calculator' => __( 'After shipping calculator', 'woocommerce-jetpack' ),
'woocommerce_cart_is_empty' => __( 'If cart is empty', 'woocommerce-jetpack' ),
),
'css' => 'width:250px;',
),
array(
'title' => '',
'desc' => __( 'Position Order (Priority)', 'left-to-free-shipping-for-woocommerce' ),
'desc_tip' => __( 'Here you can move the info inside the Position selected above.', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_priority_cart',
'default' => 10,
'type' => 'number',
'css' => 'width:250px;',
),
array(
'title' => __( 'Info on Mini Cart', 'left-to-free-shipping-for-woocommerce' ),
'desc' => __( 'Enable', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_enabled_mini_cart',
'default' => 'no',
'type' => 'checkbox',
'custom_attributes' => apply_filters( 'alg_wc_left_to_free_shipping', array( 'disabled' => 'disabled' ), 'settings' ),
'desc_tip' => apply_filters( 'alg_wc_left_to_free_shipping', sprintf( __( 'You will need Amount Left for Free Shipping for WooCommerce Pro plugin to enable this option.', 'left-to-free-shipping-for-woocommerce' ), 'https://wpcodefactory.com/item/amount-left-free-shipping-woocommerce/' ), 'settings' ),
),
array(
'title' => '',
'desc' => __( 'Content', 'left-to-free-shipping-for-woocommerce' ),
'desc_tip' => __( 'You can use HTML here.', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_content_mini_cart',
'default' => __( '%amount_left_for_free_shipping% left for free shipping', 'left-to-free-shipping-for-woocommerce' ),
'type' => 'alg_wc_alfs__custom_textarea',
'css' => 'width:30%;min-width:300px;height:100px;',
),
array(
'title' => '',
'desc' => __( 'Position', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_position_mini_cart',
'default' => 'woocommerce_after_mini_cart',
'type' => 'select',
'options' => array(
'woocommerce_before_mini_cart' => __( 'Before mini cart', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_widget_shopping_cart_before_buttons' => __( 'Before buttons', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_after_mini_cart' => __( 'After mini cart', 'left-to-free-shipping-for-woocommerce' ),
),
'css' => 'width:250px;',
),
array(
'title' => '',
'desc' => __( 'Position Order (Priority)', 'left-to-free-shipping-for-woocommerce' ),
'desc_tip' => __( 'Here you can move the info inside the Position selected above.', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_priority_mini_cart',
'default' => 10,
'type' => 'number',
'css' => 'width:250px;',
),
array(
'title' => __( 'Info on Checkout', 'left-to-free-shipping-for-woocommerce' ),
'desc' => __( 'Enable', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_enabled_checkout',
'default' => 'no',
'type' => 'checkbox',
'custom_attributes' => apply_filters( 'alg_wc_left_to_free_shipping', array( 'disabled' => 'disabled' ), 'settings' ),
'desc_tip' => apply_filters( 'alg_wc_left_to_free_shipping', sprintf( __( 'You will need Amount Left for Free Shipping for WooCommerce Pro plugin to enable this option.', 'left-to-free-shipping-for-woocommerce' ), 'https://wpcodefactory.com/item/amount-left-free-shipping-woocommerce/' ), 'settings' ),
),
array(
'title' => '',
'desc' => __( 'Content', 'left-to-free-shipping-for-woocommerce' ),
'desc_tip' => __( 'You can use HTML here.', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_content_checkout',
'default' => __( '%amount_left_for_free_shipping% left for free shipping', 'left-to-free-shipping-for-woocommerce' ),
'type' => 'alg_wc_alfs__custom_textarea',
'css' => 'width:30%;min-width:300px;height:100px;',
),
array(
'title' => '',
'desc' => __( 'Position', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_position_checkout',
'default' => 'woocommerce_checkout_after_order_review',
'type' => 'select',
'options' => array(
'woocommerce_before_checkout_form' => __( 'Before checkout form', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_checkout_before_customer_details' => __( 'Before customer details', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_checkout_billing' => __( 'Billing', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_checkout_shipping' => __( 'Shipping', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_checkout_after_customer_details' => __( 'After customer details', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_checkout_before_order_review' => __( 'Before order review', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_checkout_order_review' => __( 'Order review', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_checkout_after_order_review' => __( 'After order review', 'left-to-free-shipping-for-woocommerce' ),
'woocommerce_after_checkout_form' => __( 'After checkout form', 'left-to-free-shipping-for-woocommerce' ),
),
'css' => 'width:250px;',
),
array(
'title' => '',
'desc' => __( 'Position Order (Priority)', 'left-to-free-shipping-for-woocommerce' ),
'desc_tip' => __( 'Here you can move the info inside the Position selected above.', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_priority_checkout',
'default' => 10,
'type' => 'number',
'css' => 'width:250px;',
),
array(
'title' => __( 'Message on Free Shipping Reached', 'left-to-free-shipping-for-woocommerce' ),
'desc_tip' => __( 'To disable - set it empty.', 'left-to-free-shipping-for-woocommerce' ),
'id' => 'alg_wc_left_to_free_shipping_info_content_reached',
'default' => __( 'You have free delivery!', 'left-to-free-shipping-for-woocommerce' ),
'type' => 'alg_wc_alfs__custom_textarea',
'css' => 'width:30%;min-width:300px;height:100px;',
),
array(
'type' => 'sectionend',
'id' => 'alg_wc_left_to_free_shipping_info_options',
),
);
return $settings;
}
}
endif;
return new Alg_WC_Left_To_Free_Shipping_Settings_General();