This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
399 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
includes/admin/settings/class-gls-settings-woocommerce-shipping-instance.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
/** | ||
* | ||
* ..::.. | ||
* ..::::::::::::.. | ||
* ::'''''':''::''''':: | ||
* ::.. ..: : ....:: | ||
* :::: ::: : : :: | ||
* :::: ::: : ''' :: | ||
* ::::..:::..::.....:: | ||
* ''::::::::::::'' | ||
* ''::'' | ||
* | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Creative Commons License. | ||
* It is available through the world-wide-web at this URL: | ||
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
* If you are unable to obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. If you wish to customize this module for your | ||
* needs please contact [email protected] for more information. | ||
* | ||
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright | ||
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
*/ | ||
|
||
defined( 'ABSPATH' ) || exit; | ||
|
||
/** | ||
* Class GLS_Settings_Woocommerce_Shipping_Instance | ||
*/ | ||
class GLS_Settings_Woocommerce_Shipping_Instance | ||
{ | ||
public function __construct() | ||
{ | ||
// @formatter:off | ||
add_filter('woocommerce_shipping_instance_form_fields_tig_gls', array(__CLASS__, 'filter_woocommerce_shipping_instance_form_fields_tig_gls'), 10, 1); | ||
// @formatter:on | ||
} | ||
|
||
/** | ||
* Add extra formfields to GLS Shipping options instance in WooCommerce Shipping Settings | ||
* @param $form_fields | ||
* @return mixed | ||
*/ | ||
public function filter_woocommerce_shipping_instance_form_fields_tig_gls ($form_fields) | ||
{ | ||
|
||
$form_field_freeshipping_enabled = array( | ||
'title' => __('Enable free shipping','gls-woocommerce'), | ||
'type' => 'select', | ||
'description' => __('Enable free shipping above an order amount','gls-woocommerce'), | ||
'desc_tip' => true, | ||
'options' => array(0 => __('No','gls-woocommerce'), 1 => __('Yes','gls-woocommerce')), | ||
'default' => '0' | ||
); | ||
|
||
$form_field_freeshipping = array( | ||
'title' => __('Apply free shipping above order amount','gls-woocommerce'), | ||
'type' => 'price', | ||
'disabled' => false, | ||
'description' => __('Enter the order amount (excl. tax) above (and equal) which free shipping will be applied.','gls-woocommerce'), | ||
'desc_tip' => true, | ||
'default' => '0' | ||
); | ||
|
||
$form_field_freeshipping_extra = array( | ||
'title' => __('Apply free shipping to extra services','gls-woocommerce'), | ||
'type' => 'checkbox', | ||
'description' => __('Enable this when extra service costs are also free when free shipping applies.','gls-woocommerce'), | ||
'default' => 'no', | ||
'desc_tip' => true | ||
); | ||
|
||
|
||
$form_fields['freeshipping_enabled'] = $form_field_freeshipping_enabled; | ||
$form_fields['freeshipping'] = $form_field_freeshipping; | ||
$form_fields['freeshipping_extra'] = $form_field_freeshipping_extra; | ||
|
||
return $form_fields; | ||
} | ||
} | ||
|
||
new GLS_Settings_Woocommerce_Shipping_Instance(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.