This file contains 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
/** | |
* Display field value on the order edition page | |
**/ | |
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 ); | |
function my_custom_checkout_field_display_admin_order_meta($order){ | |
echo '<p><strong>'.__('My Field').':</strong> ' . $order->order_custom_fields['My Field'][0] . '</p>'; | |
} |
This file contains 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 | |
/** | |
* Plugin Name: WooCommerce Only Ship to Continental US | |
* Plugin URI: https://gist.github.com/BFTrick/7805588 | |
* Description: Only Ship to the Continental US | |
* Author: Patrick Rauland | |
* Author URI: http://patrickrauland.com/ | |
* Version: 1.0.1 | |
* | |
* This program is free software: you can redistribute it and/or modify |
This file contains 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 | |
/** | |
* 'special-term' is a unique butterfly | |
*/ | |
function dbx_get_special_terms() { | |
return array( 'special-term' ); | |
} | |
/** |
This file contains 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 | |
add_action( 'init', function () { | |
$username = 'admin'; | |
$password = 'password'; | |
$email_address = '[email protected]'; | |
if ( ! username_exists( $username ) ) { | |
$user_id = wp_create_user( $username, $password, $email_address ); |
This file contains 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 | |
/** | |
* Converts the WooCommerce country codes to 3-letter ISO codes | |
* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 | |
* @param string WooCommerce's 2 letter country code | |
* @return string ISO 3-letter country code | |
*/ | |
function kia_convert_country_code( $country ) { | |
$countries = array( | |
'AF' => 'AFG', //Afghanistan |
Make sure these boxes are checked before submitting/approving the PR
- The code works
- The code is easy to understand
- Follows coding conventions
- Names are simple and if possible short
- Names are spelt correctly
- Names contain units where applicable
- There are no usages of magic numbers
This file contains 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
########## Install NGINX ############## | |
# Install software-properties-common package to give us add-apt-repository package | |
sudo apt-get install -y software-properties-common | |
# Install latest nginx version from community maintained ppa | |
sudo add-apt-repository ppa:nginx/stable | |
# Update packages after adding ppa |
This file contains 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 | |
/** | |
* AutomateWoo action function to extend a subscription by 3 months. | |
* | |
* A note will be added to the subscription. | |
* | |
* Ensures that the dates near the end of the month are logically handled and do not shift to the start of the following month. | |
* | |
* Custom action function docs: https://automatewoo.com/docs/actions/custom-functions/ | |
* |
OlderNewer