Skip to content

Instantly share code, notes, and snippets.

View ibrahimmumcu's full-sized avatar

Ibrahim Mumcu ibrahimmumcu

View GitHub Profile
@ibrahimmumcu
ibrahimmumcu / functions.php
Last active January 1, 2021 16:01
Woocommerce - Remove "downloads" from my account menu items
<?php
add_filter( 'woocommerce_account_menu_items', 'custom_remove_downloads_my_account', 999 );
function custom_remove_downloads_my_account( $items ) {
unset($items['downloads']);
return $items;
}
?>
@ibrahimmumcu
ibrahimmumcu / functions.php
Created January 1, 2021 15:58
Woocommerce - Change Turkish Lira currency symbol to TL text
<?php
/**
* Change Turkish Lira currency symbol to "TL"
*/
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'TRY': $currency_symbol = 'TL'; break;
@ibrahimmumcu
ibrahimmumcu / functions.php
Created January 1, 2021 15:55
Woocommerce - Remove "url" input from comment from
<?php
/*
* Remove "url" input from comment from
*/
add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
if(isset($fields['url']))
@ibrahimmumcu
ibrahimmumcu / functions.php
Created January 1, 2021 15:50
Woocommerce - Remove "Fixed Price" label from shipping method on the cart page.
<?php
/*
* Remove "Fixed Price" label from shipping method on the cart page.
*/
add_filter( 'woocommerce_cart_shipping_method_full_label', 'bbloomer_remove_shipping_label', 9999, 2 );
function bbloomer_remove_shipping_label( $label, $method ) {
$new_label = preg_replace( '/^.+:/', '', $label );
return $new_label;
@ibrahimmumcu
ibrahimmumcu / functions.php
Created January 1, 2021 15:43
Woocommerce - Hide shipping rates when free shipping is available.
<?php
/**
* Hide shipping rates when free shipping is available.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function my_hide_shipping_when_free_is_available( $rates ) {
$free = array();
@ibrahimmumcu
ibrahimmumcu / functions.php
Last active January 1, 2021 16:03
Woocommerce - Check whether a page is woocommerce page
<?php
/**
* is_really_woocommerce_page - Returns true if on a page which uses WooCommerce templates
*
* @access public
* @return bool
*/
function is_really_woocommerce_page () {
if( function_exists ( "is_woocommerce" ) && is_woocommerce()){