Skip to content

Instantly share code, notes, and snippets.

@statickidz
statickidz / functions.php
Last active February 24, 2024 04:35
Woocommerce - Show Custom Filter and Admin Column for Catalog Visibility
<?php
/**
* @snippet Show Custom Filter and Admin Column for Catalog Visibility @ WooCommerce Products Admin
* @sourcecode https://gist.github.com/statickidz/6a539550d8e0d13d2c3d12318672e816
* @author Adrián Barrio Andrés (statickidz.com)
*/
add_filter('woocommerce_product_filters', 'skidz_filter_by_catalog_visibility_dashboard_products');
@met-eric
met-eric / Add WooCommerce Empty Cart Button.php
Last active November 22, 2022 18:46
Add WooCommerce Empty Cart Button.php
add_action( 'woocommerce_cart_coupon', 'custom_woocommerce_empty_cart_button' );
function custom_woocommerce_empty_cart_button() {
echo '<a href="' . esc_url( add_query_arg( 'empty_cart', 'yes' ) ) . '" class="button" title="' . esc_attr( 'Empty Cart', 'woocommerce' ) . '">' . esc_html( 'Empty Cart', 'woocommerce' ) . '</a>';
}
add_action( 'wp_loaded', 'custom_woocommerce_empty_cart_action', 20 );
function custom_woocommerce_empty_cart_action() {
if ( isset( $_GET['empty_cart'] ) && 'yes' === esc_html( $_GET['empty_cart'] ) ) {
WC()->cart->empty_cart();