PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.14
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.14
1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 1.3.47 1.3.46 1.3.45 All 177 releases
disco / functions / coupon.php

coupon.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.4.14, at functions/coupon.php

39 lines 866 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable
3 /**
4 * Disco
5 *
6 * @package Disco
7 * @author Ohidul Islam <wahid0003@gmail.com>
8 * @link http://domain.tld
9 * @license GPL 2.0+
10 * @copyright 2022 WebAppick
11 */
12
13 // Ensure the file is not accessed directly.
14 if (!defined('ABSPATH')) {
15 exit;
16 }
17
18 use Disco\App\Utility\Settings;
19
20 if( ! function_exists( 'disco_get_coupon_discount' ) ) {
21
22 /**
23 * Get the discount amount for a coupon.
24 *
25 * @param string $coupon_code Coupon code.
26 * @return float
27 */
28 function disco_disable_coupon_application( $valid, $coupon, $discount ) {
29 if ( Settings::get( 'discount_priority_type' ) === 'both' ) {
30 return $valid; // Allow coupon validation if the setting is enabled.
31 }
32 return false; // This will prevent all coupons from being valid
33 }
34
35 add_filter( 'woocommerce_coupon_is_valid', 'disco_disable_coupon_application', 10, 3 );
36 }
37
38
39