Skip to content

Instantly share code, notes, and snippets.

@mcfarlan
Last active September 28, 2017 17:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcfarlan/434a7af84345c9893db2f5843b210fa2 to your computer and use it in GitHub Desktop.
Save mcfarlan/434a7af84345c9893db2f5843b210fa2 to your computer and use it in GitHub Desktop.
Looks for deprecated WooCommerce filters (v3.x.x)
#!/bin/bash
FUNCTIONS="
woocommerce_email_order_schema_markup,
add_to_cart_fragments,
add_to_cart_redirect,
woocommerce_product_width,
woocommerce_product_height,
woocommerce_product_length,
woocommerce_product_weight,
woocommerce_get_sku,
woocommerce_get_price,
woocommerce_get_regular_price,
woocommerce_get_sale_price,
woocommerce_product_tax_class,
woocommerce_get_stock_quantity,
woocommerce_get_product_attributes,
woocommerce_product_gallery_attachment_ids,
woocommerce_product_review_count,
woocommerce_product_files,
woocommerce_get_currency,
woocommerce_order_amount_discount_total,
woocommerce_order_amount_discount_tax,
woocommerce_order_amount_shipping_total,
woocommerce_order_amount_shipping_tax,
woocommerce_order_amount_cart_tax,
woocommerce_order_amount_total,
woocommerce_order_amount_total_tax,
woocommerce_order_amount_total_discount,
woocommerce_order_amount_subtotal,
woocommerce_order_tax_totals,
woocommerce_refund_amount,
woocommerce_refund_reason,
default_checkout_country,
default_checkout_state,
default_checkout_postcode"
OUTPUT="deprecated-woo.txt"
count=$(expr 1)
for i in $(echo $FUNCTIONS | sed "s/,/ /g")
do
# find any deprecated uses
echo 'Searching ---> ' $i
echo '--' $i '--' >> $OUTPUT
grep -rli $i app/* >> $OUTPUT
# spacers between files
echo ' ' >> $OUTPUT
echo '----------' >> $OUTPUT
echo ' ' >> $OUTPUT
done
@chrisvanpatten
Copy link

This is awesome, Ian!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment