This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GET number of orders | |
select count(*)from wp_posts where post_type = 'shop_order'; | |
# DELETE ORDERS | |
delete from wp_postmeta where post_id in ( | |
select ID from wp_posts where post_type = 'shop_order'); | |
delete from wp_posts where post_type = 'shop_order'; | |
# DELETE order refunds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Code goes in theme functions.php */ | |
add_filter( 'woocommerce_email_template_store_credit', 'wc_ninja_store_credit_template' ); | |
function wc_ninja_store_credit_template() { | |
return get_stylesheet_directory() . "/woocommerce/customer-store-credit.php"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Change the default country on the checkout for non-existing users only | |
*/ | |
add_filter( 'default_checkout_billing_country', 'change_default_checkout_country', 10, 1 ); | |
function change_default_checkout_country( $country ) { | |
// If the user already exists, don't override country | |
if ( WC()->customer->get_is_paying_customer() ) { | |
return $country; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hide shipping rates when free shipping is available, but keep "Local pickup" | |
* Updated to support WooCommerce 2.6 Shipping Zones | |
*/ | |
function hide_shipping_when_free_is_available( $rates, $package ) { | |
$new_rates = array(); | |
foreach ( $rates as $rate_id => $rate ) { | |
// Only modify rates if free_shipping is present. | |
if ( 'free_shipping' === $rate->method_id ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check if WooCommerce is activated | |
*/ | |
if ( ! function_exists( 'is_woocommerce_activated' ) ) { | |
function is_woocommerce_activated() { | |
if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wc_remove_var_subscriptions_price() { | |
return ''; | |
} | |
add_filter( 'woocommerce_variable_subscription_price_html', 'wc_remove_var_subscriptions_price' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wc_stripe_payment_icons', 'change_my_icons' ); | |
function change_my_icons( $icons ) { | |
// var_dump( $icons ); to show all possible icons to change. | |
$icons['visa'] = '<img src="http://woocommerce-ext.reh/wp-content/plugins/woocommerce/assets/images/icons/credit-cards/visa.svg" />'; | |
$icons['mastercard'] = '<img src="http://woocommerce-ext.reh/wp-content/plugins/woocommerce/assets/images/icons/credit-cards/mastercard.svg" />'; | |
$icons['amex'] = '<img src="http://woocommerce-ext.reh/wp-content/plugins/woocommerce/assets/images/icons/credit-cards/amex.svg" />'; | |
return $icons; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wc_subscriptions_custom_price_string( $pricestring ) { | |
$newprice = str_replace( 'every 3 months', 'per season', $pricestring ); | |
return $newprice; | |
} | |
add_filter( 'woocommerce_subscriptions_product_price_string', 'wc_subscriptions_custom_price_string' ); | |
add_filter( 'woocommerce_subscription_price_string', 'wc_subscriptions_custom_price_string' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Checks if the cart contains a product bundle | |
* @return [bool] | |
*/ | |
function cart_contains_product_bundle(){ | |
global $woocommerce; | |
$contains_product_bundle = false; | |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) { | |
// if cart has items |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function change_gravity_add_to_cart() { | |
return 'Changed Text'; | |
} | |
add_filter( 'woocommerce_gforms_add_to_cart_text', 'change_gravity_add_to_cart' ); |