Remove wocommerce coupon field from woocommerce checkout page

Here is a quick snippet to remove woocommerce coupon field from woocommerce checkout page. When you enable the use of coupons, woocommerce adds the apply coupon form in cart and checkout page. For our customization want to remove woocommerce coupon field from checkout page then place the following snippet in functions.php within your theme folder!.

function hide_coupon_field_on_woocommerce_checkout( $enabled ) {
	if ( is_checkout() ) {
		$enabled = false;
	}
	return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_woocommerce_checkout' );

Have any doubt, then comment here!

Remove woocommerce coupon field from woocommerce cart page

Here is a quick snippet to remove woocommerce coupon field from woocommerce cart page. When you enable the use of coupons, woocommerce adds the apply coupon form in cart and checkout page. For our customization want to remove woocommerce coupon field from cart page then place the following snippet in functions.php within your theme folder!.

function hide_coupon_field_on_woocommerce_cart( $enabled ) {
	if ( is_cart() ) {
		$enabled = false;
	}
	return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_woocommerce_cart' );

Have any doubt, then comment here!

Add new currency and symbol to woocommerce using filter

Here is a quick snippet to add new custom currency and symbol to wocommerce. Place the following snippet in functions.php within your theme folder. After adding this code your currency will be available in your WooCommerce settings page.

add_filter( 'woocommerce_currencies', 'add_my_custom_currency' );

function add_my_custom_currency( $currencies ) {
     $currencies['BOO'] = __( 'Your currency name', 'woocommerce' );
     return $currencies;
}

add_filter('woocommerce_currency_symbol', 'add_my_custom_currency_symbol', 10, 2);

function add_my_custom_currency_symbol( $currency_symbol, $currency ) {
     switch( $currency ) {
          case 'BOO': $currency_symbol = '$'; break;
     }
     return $currency_symbol;
}

Have any doubt, then comment here!

Redirect to home page after logout in WordPress

Add the following code in functions.php within your theme folder for redirect customers into home page after logout in WordPress

add_filter('logout_url', 'new_logout_url', 10, 2);
function new_logout_url($logouturl, $redir)
{
	$redir = get_option('siteurl');
	return $logouturl . '&redirect_to=' . urlencode($redir);
}

Have any doubt, then comment here!