You appear to be a bot. Output may be restricted
Description
Remove an active discount from the shopping cart
Usage
$array = edd_unset_cart_discount( $code );
Parameters
- $code
- ( string ) optional – Discount code
Returns
array $discounts All remaining active discounts
Source
File name: easy-digital-downloads/includes/discount-functions.php
Lines:
1 to 21 of 21
function edd_unset_cart_discount( $code = '' ) { $discounts = edd_get_cart_discounts(); if ( $discounts ) { $discounts = array_map( 'strtoupper', $discounts ); $key = array_search( strtoupper( $code ), $discounts ); if ( false !== $key ) { unset( $discounts[ $key ] ); } $discounts = implode( '|', array_values( $discounts ) ); // update the active discounts EDD()->session->set( 'cart_discounts', $discounts ); } do_action( 'edd_cart_discount_removed', $code, $discounts ); do_action( 'edd_cart_discounts_updated', $discounts ); return $discounts; }