-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathwoocommerce-cart-stock-reducer.php
49 lines (42 loc) · 1.81 KB
/
woocommerce-cart-stock-reducer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/*
Plugin Name: WooCommerce Cart Stock Reducer
Description: Allow WooCommerce inventory stock to be reduced when adding items to cart and/or expire items from the cart
Version: 3.90
Author: James Golovich
License: GPL2
Requires at least: 4.0
Tested up to: 5.8.1
Text Domain: woocommerce-cart-stock-reducer
Domain Path: /languages/
WC requires at least: 3.0
WC tested up to: 5.6.0
*/
/* Copyright 2014 James Golovich (email : [email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
function make_cart_stock_reducer_go_now( $integrations = array() ) {
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
WC_Admin_Settings::add_message( __( 'WooCommerce Cart Stock Reducer requires WooCommerce 3.0 or newer.', 'woocommerce-cart-stock-reducer' ) );
return $integrations;
}
if ( class_exists( 'WC_Integration' ) ) {
// Three... Two... One... MAKE ROCKET GO NOW!
define( 'WCCSR_VERSION', '3.90' );
require_once plugin_dir_path( __FILE__ ) . 'includes/class-woocommerce-cart-stock-reducer.php';
$integrations[] = 'WC_Cart_Stock_Reducer';
return $integrations;
}
}
add_action( 'woocommerce_integrations', 'make_cart_stock_reducer_go_now' );