Skip to content

Instantly share code, notes, and snippets.

Clifton Griffin clifgriffin

Block or report user

Report or block clifgriffin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View move-ignitewoo-gift-card-voucher-form.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
global $ignite_gift_certs;
remove_action( 'woocommerce_checkout_after_customer_details', array( $ignite_gift_certs, 'recipient_detail_form' ), 999, 5 );
add_action( 'cfw_checkout_after_billing_address', array( $ignite_gift_certs, 'recipient_detail_form' ) );
View astra-ast-auto-prev-post-fix.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_action( 'wp', 'block_astra_single_autopost_infinite_on_checkout' );
function block_astra_single_autopost_infinite_on_checkout() {
if ( function_exists( 'is_checkout' ) && is_checkout() ) {
apply_filters( 'astra_get_option_ast-auto-prev-post', '__return_false' );
}
@clifgriffin
clifgriffin / move-eu-vat-number-to-shipping-tab.php
Created May 8, 2019
Move EU VAT Number field to shipping tab for CheckoutWC (https://www.checkoutwc.com)
View move-eu-vat-number-to-shipping-tab.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_action( 'wp', 'move_eu_vat_number_field' );
function move_eu_vat_number_field() {
remove_action( 'woocommerce_after_checkout_billing_form', array( 'WC_EU_VAT_Number', 'vat_number_field' ) );
add_action( 'cfw_checkout_after_customer_info_address', array( 'WC_EU_VAT_Number', 'vat_number_field' ) );
}
@clifgriffin
clifgriffin / convert-plugins-to-composer.sh
Last active May 6, 2019
Remove plugins and re-add with composer.
View convert-plugins-to-composer.sh
#!/bin/bash
for plugin in `wp plugin list | grep -v "on line" | grep -v "version" | awk '{print $1}'`; do
if search_result=$(composer search wpackagist-plugin/$plugin | grep "^wpackagist-plugin/$plugin$")
then
git rm -r wp-content/plugins/$plugin
git commit -m "Temporarily removed $plugin"
composer require wpackagist-plugin/$plugin
echo "wp-content/plugins/$plugin" >> .gitignore
git add -A
@clifgriffin
clifgriffin / checkoutwc-addons.php
Created Apr 24, 2019
Adding add-ons to CheckoutWC
View checkoutwc-addons.php
<?php
class Foo {
public function __construct() {
add_action( 'cfw_admin_addon_tabs', array( $this, 'add_some_cfw_addons' ), 10, 1);
}
function add_some_cfw_addons( $addon_tabs ) {
$addon_tabs[ 'checkout-field-editor' ] = array(
'name' => 'Field Editor',
'function' => array($this, 'cfe_tab'),
@clifgriffin
clifgriffin / remove-address-line-2.php
Last active May 2, 2019
Remove address line 2 from Checkout for WooCommerce.
View remove-address-line-2.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
// Set address 2 to not required
add_filter('woocommerce_checkout_fields', 'unrequire_address_2_checkout_fields' );
function unrequire_address_2_checkout_fields( $fields ) {
$fields['billing']['billing_address_2']['required'] = false;
$fields['shipping']['shipping_address_2']['required'] = false;
@clifgriffin
clifgriffin / force-woocommerce-country.php
Created Apr 8, 2019
Force WooCommerce to show country in shipping address preview.
View force-woocommerce-country.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_filter( 'woocommerce_formatted_address_force_country_display', '__return_true' );
@clifgriffin
clifgriffin / set-username-to-email.php
Created Apr 8, 2019
Force WooCommerce to use email address as username when registering new accounts.
View set-username-to-email.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_filter( 'pre_user_login' , 'cfw_set_username_to_email' );
function cfw_set_username_to_email( $user_login ) {
if( isset($_POST['billing_email'] ) ) {
$user_login = $_POST['billing_email'];
@clifgriffin
clifgriffin / signature-required-custom-field.php
Created Apr 3, 2019
Add a signature required checkbox field to the checkout page after the order notes.
View signature-required-custom-field.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
/**
* You can use the following example to add virtually any custom fields
* to the checkout page. To more specifically control the location, use
* our hook guide: https://kb.checkoutwc.com/article/25-actions
*/
@clifgriffin
clifgriffin / change_site_name_in_createa_account_checkbox_label.php
Created Apr 3, 2019
Change site name in create shopping account label.
View change_site_name_in_createa_account_checkbox_label.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
// Change site name in "Create % shopping account" checkbox label
add_filter( 'cfw_create_account_site_name', 'change_create_account_site_name' );
function change_create_account_site_name( $site_name ) {
$site_name = 'Microsoft';
You can’t perform that action at this time.