Skip to content

Instantly share code, notes, and snippets.

View mio31337's full-sized avatar
🎳
Multiprojecting

Mario Markovic mio31337

🎳
Multiprojecting
View GitHub Profile
@mio31337
mio31337 / functions.php
Created April 8, 2020 17:05
WooCommerce: Remove downloads tab in My Account
/**
* Remove downloads tab in My Account
* Author: MarioMarkovic.com
*/
add_filter( 'woocommerce_account_menu_items', 'custom_remove_downloads_my_account', 999 );
function custom_remove_downloads_my_account( $items ) {
unset($items['downloads']);
return $items;
}
@mio31337
mio31337 / functions.php
Last active April 8, 2020 17:06
WooCommerce: Add custom tabs
/**
* Add custom tabs
* Author: MarioMarkovic.com
*/
add_filter( 'woocommerce_product_tabs', 'custom_product_tabs' );
function custom_product_tabs( $tabs ) {
if(get_field('navodila_za_uporabo')) {
$tabs['general'] = array(
'title' => __('Navodila za uporabo', 'nm-framework'),
'callback' => 'product_tab_instructions_content',
@mio31337
mio31337 / functions.php
Last active April 8, 2020 17:01
WooCommerce: Hide other shipping rates when free shipping is available.
/**
* Hide other shipping rates when free shipping is available.
* Updated to support WooCommerce 2.6 Shipping Zones.
* Author: MarioMarkovic.com
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function hide_shipping_when_free_is_available( $rates ) {
$free = array();
@mio31337
mio31337 / functions.php
Last active April 8, 2020 16:56
WooCommerce: Add reference ID in BACS Payment Method - Bank Details (Displayed on confirmation E-mail and Thank You Page)
/**
* WooCommerce: Add reference ID in BACS Payment Method - Bank Details (Displayed on confirmation E-mail and Thank You Page)
* Author: MarioMarkovic.com
*/
add_filter( 'woocommerce_bacs_account_fields', 'custom_bacs_account_field', 10, 2);
function custom_bacs_account_field( $account_fields, $order_id ) {
$order = wc_get_order( $order_id );
$account_fields['reference_no' ] = array(
'label' => "Reference No.",