Plugin Directory

Changeset 2857355


Ignore:
Timestamp:
01/30/2023 10:05:49 PM (3 years ago)
Author:
philsafc
Message:

Plugin update to 1.0.1
Bug fix

Location:
disable-coupons-at-product-level
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • disable-coupons-at-product-level/trunk/disable-coupons.php

    r2856693 r2857355  
    33 * Plugin Name: Disable Coupons At Product Level
    44 * Description: A plugin to disable coupons on selected products
    5  * Version:     1.0
     5 * Version:     1.0.1
    66 * Author:      Phil Clerkin
    77 * Author URI:  https://greyphox.com/
     
    2626
    2727
    28 add_action( 'woocommerce_product_data_panels', 'DCAPL_add_custom_field_general_product_fields' );
    29 function DCAPL_add_custom_field_general_product_fields(){
     28add_action( 'woocommerce_product_data_panels', 'DCAPL_add_custom_field_General_product_fields' );
     29function DCAPL_add_custom_field_General_product_fields(){
    3030    global $post;
    31 
     31    $disable_coupons = get_post_meta( $post->ID, 'DCAPL_disable_coupons', true );
    3232    echo '<div id="DCAPL_product_data" class="panel woocommerce_options_panel">';
    33 
    34     // Custom Product Checkbox Field Info
    3533    woocommerce_wp_checkbox( array(
    3634        'id'        => '_disable_coupons',
     
    3836        'description' => __('If checked discounts will not be applied to this product via the use of coupons', 'woocommerce'),
    3937        'desc_tip'  => 'true',
     38        'value'     => $disable_coupons == 'yes' ? 'yes' : 'no'
    4039    ) );
    4140    echo '</div>';
    4241}
     42
     43
    4344
    4445
     
    6970add_filter( 'woocommerce_coupon_get_discount_amount', 'DCAPL_zero_discount_for_excluded_products', 12, 5 );
    7071function DCAPL_zero_discount_for_excluded_products($discount, $discounting_amount, $cart_item, $single, $coupon ){
    71 $disabled_products = get_option( 'DCAPL__products_disable_coupons' );
     72$disabled_products = get_option( 'DCAPL_products_disable_coupons' );
    7273$discount = count( $disabled_products ) > 0 && in_array( $cart_item['product_id'], $disabled_products ) ? 0 : $discount;
    7374return $discount;
  • disable-coupons-at-product-level/trunk/readme.txt

    r2856699 r2857355  
    77License: GPLv2 or later
    88License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
    9 Stable tag: 1.0
     9Stable tag: 1.0.1
    1010
    1111A Wordpress plugin that allows users to disable customers use of coupons on selected products in WooCommerce
     
    27271. View of options on product screen
    2828
     29
     30== Changelog ==
     31
     32= 1.0.1 =
     33
     34- Fixed: Checkbox field status not saving on product page
Note: See TracChangeset for help on using the changeset viewer.