Skip to content

Commit b10b616

Browse files
authored
Add files via upload
1 parent 3289bf9 commit b10b616

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- This is a code snippets export file generated by the Code Snippets WordPress plugin. -->
3+
<!-- https://wordpress.org/plugins/code-snippets -->
4+
<!-- To import these snippets a WordPress site follow these steps: -->
5+
<!-- 1. Log in to that site as an administrator. -->
6+
<!-- 2. Install the Code Snippets plugin using the directions provided at the above link. -->
7+
<!-- 3. Go to 'Tools: Import' in the WordPress admin panel. -->
8+
<!-- 4. Click on the "Code Snippets" importer in the list -->
9+
<!-- 5. Upload this file using the form provided on that page. -->
10+
<!-- 6. Code Snippets will then import all of the snippets and associated information contained in this file into your site. -->
11+
<!-- 7. You will then have to visit the 'Snippets: All Snippets' admin menu and activate desired snippets. -->
12+
<!-- generator="Code Snippets/2.8.6" created="2017-06-27 13:38" -->
13+
<snippets>
14+
<snippet scope="2">
15+
<name>WooCommerce add an Empty Cart button</name>
16+
<desc></desc>
17+
<tags>woocommerce, empty, cart</tags>
18+
<code>// check for empty-cart get param to clear the cart&#13;
19+
add_action( 'init', 'woocommerce_clear_cart_url' );&#13;
20+
function woocommerce_clear_cart_url() {&#13;
21+
global $woocommerce;&#13;
22+
if ( isset( $_GET['empty-cart'] ) ) {&#13;
23+
$woocommerce-&gt;cart-&gt;empty_cart();&#13;
24+
}&#13;
25+
}&#13;
26+
add_action( 'woocommerce_cart_actions', 'woocommerce_add_clear_cart_button', 20 );&#13;
27+
function woocommerce_add_clear_cart_button() {&#13;
28+
echo "&lt;a class='button' href='?empty-cart=true'&gt;" . __( 'Empty Cart', 'woocommerce' ) . "&lt;/a&gt;";&#13;
29+
} </code>
30+
</snippet>
31+
</snippets>

0 commit comments

Comments
 (0)