Skip to content

Instantly share code, notes, and snippets.

View Bobz-zg's full-sized avatar
👨‍💻
working remotely

Vlado Bosnjak Bobz-zg

👨‍💻
working remotely
View GitHub Profile
@Bobz-zg
Bobz-zg / include-email-in-woocommerce-address-output.php
Created February 12, 2021 09:05
Include email address in WooCommerce address output | Part 1
<?php
/**
* Append email to address format
*
* @link https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-countries.php#L510
*/
add_filter( 'woocommerce_localisation_address_formats', function( $formats ) {
// Double quotes in sprintf() or \n will not be parsed as a new line character
@Bobz-zg
Bobz-zg / include-email-in-woocommerce-address-output.php
Last active February 16, 2021 05:18
Include email address in WooCommerce address output | Part 2
<?php
/**
* Append email in list of visible info
*
* @link https://github.com/woocommerce/woocommerce/blob/ab4a46e32e338cbf33094ab26144744a021a21a9/includes/wc-account-functions.php#L316
*/
add_filter( 'woocommerce_my_account_my_address_formatted_address', function( $address, $user_id, $address_type ) {
// Meta key is either billing or shipping
$meta_key = $address_type . '_email';
@Bobz-zg
Bobz-zg / include-email-in-woocommerce-address-output.php
Created February 12, 2021 09:16
Include email address in WooCommerce address output | Part 3
<?php
/**
* Replace {email} shortcode with actual email address
*
* @link https://github.com/woocommerce/woocommerce/blob/5a707f3e74a18af2d7bf14c20ee65e702a119557/includes/class-wc-countries.php#L601
*/
add_filter('woocommerce_formatted_address_replacements', function( $address, $args ) {
// Replace email for billing address
if ( isset( $args['billing_email'] ) )
@Bobz-zg
Bobz-zg / lightning-address.php
Last active June 6, 2022 06:49
Add Lightning address to WordPress head
<?php
/**
* Plugin Name: Lightning Address
* Plugin URI: https://gist.github.com/Bobz-zg/5e8fe19442d88ddb32bae428dfc199f3/edit
* Author: Vlado Bosnjak
* Author URI: https://github.com/code-soup
* Description: Handle the basics with this plugin.
* Version: 0.0.1
* Requires at least: 5.2