1 <?php
 2 /**
 3  * WooCommerce Coupons Functions
 4  *
 5  * Functions for coupon specific things.
 6  *
 7  * @author      WooThemes
 8  * @category    Core
 9  * @package     WooCommerce/Functions
10  * @version     2.1.0
11  */
12 
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14 
15 /**
16  * Get coupon types.
17  *
18  * @return array
19  */
20 function wc_get_coupon_types() {
21     return (array) apply_filters( 'woocommerce_coupon_discount_types', array(
22         'fixed_cart'      => __( 'Cart Discount', 'woocommerce' ),
23         'percent'         => __( 'Cart % Discount', 'woocommerce' ),
24         'fixed_product'   => __( 'Product Discount', 'woocommerce' ),
25         'percent_product' => __( 'Product % Discount', 'woocommerce' )
26     ) );
27 }
28 
29 /**
30  * Get a coupon type's name.
31  *
32  * @param string $type (default: '')
33  * @return string
34  */
35 function wc_get_coupon_type( $type = '' ) {
36     $types = wc_get_coupon_types();
37     if ( isset( $types[ $type ] ) )
38         return $types[ $type ];
39 
40     return '';
41 }
42 
WooCommerce API documentation generated by ApiGen 2.8.0