• Resolved roussylucien

    (@roussylucien)


    Hy there,
    I custom your plugin for add the possibility for poeple to wrote product categories you want to apply the expire time.

    I don’t know if you want add this to the main plugin, but for me it’s very usefull.
    Maybe it’s not the most elegant method and code for that but it’s works so I offert that to anybody need it.

    I just add in class-woocommerce-cart-stock-reducer.php this lines:

    
    Line 37:
    $this->expire_cat = $this->get_option( 'expire_cat' );
    Line 499:
    $item_id = $product->id;
    if ( has_term( array($this->expire_cat ), 'product_cat', $item_id ) ) {
    $this->expire_items = 'yes';
    }else{
    $this->expire_items = 'no';    
    }
    Line 1033:
    'expire_cat' => array(
    'title' => __( 'Expire Category', 'woocommerce-cart-stock-reducer' ),
    'type' => 'text',
    'description' => __( 'witch category you will with expire time', 'woocommerce-cart-stock-reducer' ),
    'desc_tip' => true,
    'placeholder' => '12, 15, 17',
    'default' => ''
        ),

    Maybe that can help some peoples and maybe you will find a most elegant code for that.

    Thanks a lot for your plugin

    • This topic was modified 3 years, 9 months ago by roussylucien.
    • This topic was modified 3 years, 9 months ago by roussylucien.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author James Golovich

    (@jamesgol)

    Thanks for sharing, I know someone has asked for this in the past. When I get a chance I’ll see how to integrate it, likely need to add a boolean option to enable/disable this specific feature.

    If your store is in english, you probably want to use ‘which’ instead of ‘witch’, unless you have a spellcasting magical category to use.

    Thread Starter roussylucien

    (@roussylucien)

    You welcome, it’s pleasure to contribute for good plugin.

    Yes, I think ‘which’ it’s a better option.

    Plugin Author James Golovich

    (@jamesgol)

    I just added this feature to the development version, a new release will be pushed out soon.

    In addition to specifying a comma separated list in the config, the list of categories can be modified with the WordPress filter ‘wc_csr_expire_categories’

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘disable expire items for some categories’ is closed to new replies.