Put back coupon option.
This commit is contained in:
parent
2a9634172c
commit
bc51d5652b
|
@ -99,7 +99,16 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
|
||||
array( 'type' => 'sectionend', 'id' => 'general_options'),
|
||||
|
||||
array( 'title' => __( 'Checkout and Accounts', 'woocommerce' ), 'type' => 'title', 'id' => 'checkout_account_options' ),
|
||||
array( 'title' => __( 'Cart, Checkout and Accounts', 'woocommerce' ), 'type' => 'title', 'id' => 'checkout_account_options' ),
|
||||
|
||||
array(
|
||||
'title' => __( 'Coupons', 'woocommerce' ),
|
||||
'desc' => __( 'Enable the use of coupons', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_coupons',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Checkout', 'woocommerce' ),
|
||||
|
@ -125,7 +134,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'type' => 'checkbox',
|
||||
'checkboxgroup' => '',
|
||||
'show_if_checked' => 'option',
|
||||
'desc_tip' => __( 'Force SSL (HTTPS) on the checkout pages (an SSL Certificate is required)', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Force SSL (HTTPS) on the checkout pages (an SSL Certificate is required).', 'woocommerce' ),
|
||||
),
|
||||
|
||||
array(
|
||||
|
@ -204,10 +213,10 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Enable WooCommerce lightbox', 'woocommerce' ),
|
||||
'desc' => __( 'Enable Lightbox', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_lightbox',
|
||||
'default' => 'yes',
|
||||
'desc_tip' => __( 'On the product details page, product gallery images will open in a lightbox. The Add Review form will also open in a modal window.', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Include WooCommerce\'s lightbox. Product gallery images and the add review form will open in a lightbox.', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start'
|
||||
),
|
||||
|
@ -217,7 +226,8 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'id' => 'woocommerce_enable_chosen',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end'
|
||||
'checkboxgroup' => 'end',
|
||||
'desc_tip' => __( 'This will enable a script allowing the country fields to be searchable.', 'woocommerce' ),
|
||||
),
|
||||
|
||||
array( 'type' => 'sectionend', 'id' => 'script_styling_options'),
|
||||
|
@ -255,7 +265,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'id' => 'woocommerce_downloads_grant_access_after_payment',
|
||||
'type' => 'checkbox',
|
||||
'default' => 'yes',
|
||||
'desc_tip' => __( 'Turn this option off to only grant access when an order is "complete", rather than "processing"', 'woocommerce' ),
|
||||
'desc_tip' => __( 'Enable this option to grant access to downloads when orders are "processing", rather than "completed".', 'woocommerce' ),
|
||||
'checkboxgroup' => 'end'
|
||||
),
|
||||
|
||||
|
|
|
@ -598,9 +598,13 @@ function woocommerce_admin_fields( $options ) {
|
|||
}
|
||||
|
||||
if ( $tip && in_array( $value['type'], array( 'checkbox' ) ) ) {
|
||||
$tip = '<span class="help_tip" data-tip="' . esc_attr( $tip ) . '">[?]</span>';
|
||||
|
||||
$tip = '<p class="description">' . $tip . '</p>';
|
||||
|
||||
} elseif ( $tip ) {
|
||||
|
||||
$tip = '<img class="help_tip" data-tip="' . esc_attr( $tip ) . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" height="16" width="16" />';
|
||||
|
||||
}
|
||||
|
||||
// Switch based on type
|
||||
|
@ -797,7 +801,7 @@ function woocommerce_admin_fields( $options ) {
|
|||
value="1"
|
||||
<?php checked( $option_value, 'yes'); ?>
|
||||
<?php echo implode( ' ', $custom_attributes ); ?>
|
||||
/> <?php echo wp_kses_post( $value['desc'] ) ?></label> <?php echo $tip; ?><br />
|
||||
/> <?php echo wp_kses_post( $value['desc'] ) ?></label> <?php echo $tip; ?>
|
||||
<?php
|
||||
|
||||
if ( ! isset( $value['checkboxgroup'] ) || ( isset( $value['checkboxgroup'] ) && $value['checkboxgroup'] == 'end' ) ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1611,9 +1611,16 @@ img.help_tip {
|
|||
float: right;
|
||||
}
|
||||
fieldset {
|
||||
margin-top: 4px;
|
||||
img.help_tip {
|
||||
margin: -3px 0 0 5px;
|
||||
}
|
||||
p.description {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
.color_box {
|
||||
border: 1px solid #ccc;
|
||||
|
|
|
@ -289,15 +289,13 @@ class WC_Cart {
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* If there are no coupons, return false to disable coupon forms. Filterable.
|
||||
* Coupons enabled function. Filterable.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function coupons_enabled() {
|
||||
|
||||
$coupon_count = wp_count_posts( 'shop_coupon' );
|
||||
$coupons_enabled = $coupon_count->publish > 0 ? true : false;
|
||||
$coupons_enabled = get_option( 'woocommerce_enable_coupons' ) == 'no' ? false : true;
|
||||
|
||||
return apply_filters( 'woocommerce_coupons_enabled', $coupons_enabled );
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
global $woocommerce;
|
||||
|
||||
if ( ! $woocommerce->cart->coupons_enabled() )
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue