Skip to content

Instantly share code, notes, and snippets.

@kurtschlatzer
Forked from WebEndevSnippets/cart.php
Created April 19, 2018 15:21
Show Gist options
  • Select an option

  • Save kurtschlatzer/ebaf35cd3e5c033c7cc30cf83fbb9006 to your computer and use it in GitHub Desktop.

Select an option

Save kurtschlatzer/ebaf35cd3e5c033c7cc30cf83fbb9006 to your computer and use it in GitHub Desktop.

Revisions

  1. @WebEndevSnippets WebEndevSnippets revised this gist Jun 4, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cart.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <input type="submit" class="button" name="clear-cart" value="<?php _e('Empty Cart', 'woocommerce'); ?>" />
  2. @WebEndevSnippets WebEndevSnippets created this gist Jun 4, 2013.
    10 changes: 10 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    /**
    * Clear Cart for WooCommerce
    */
    add_action( 'init', 'we_woocommerce_clear_cart_url' );
    function we_woocommerce_clear_cart_url() {
    global $woocommerce;
    if( isset($_REQUEST['clear-cart']) ) {
    $woocommerce->cart->empty_cart();
    }
    }