EDD: Empty Cart Link Shortcode
Registers a [scseed_edd_empty_cart] shortcode that outputs a link customers can click to clear their entire EDD shopping cart.
PHPby SnipCraft
php
<?php
add_shortcode( 'scseed_edd_empty_cart', 'scseed_edd_empty_cart_shortcode' );
function scseed_edd_empty_cart_shortcode( $atts ) {
if ( ! function_exists( 'edd_get_checkout_uri' ) ) {
return '';
}
$atts = shortcode_atts(
array(
'label' => __( 'Empty Cart', 'scseed' ),
'class' => 'scseed-empty-cart-link',
),
$atts,
'scseed_edd_empty_cart'
);
$url = add_query_arg( array( 'edd_action' => 'empty_cart' ), edd_get_checkout_uri() );
return sprintf(
'<a href="%s" class="%s">%s</a>',
esc_url( $url ),
esc_attr( $atts['class'] ),
esc_html( $atts['label'] )
);
}#cart#edd#frontend#shortcode#ux