Created
April 9, 2015 22:14
-
-
Save BurlesonBrad/bd9c65f17fa38b28f0e5 to your computer and use it in GitHub Desktop.
child functions.php 2
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_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
function custom_override_checkout_fields( $fields ) { | |
unset($fields['billing']['billing_company']); | |
unset($fields['billing']['billing_address_1']); | |
unset($fields['billing']['billing_address_2']); | |
unset($fields['billing']['billing_city']); | |
unset($fields['billing']['billing_postcode']); | |
unset($fields['billing']['billing_country']); | |
unset($fields['billing']['billing_state']); | |
unset($fields['billing']['billing_phone']); | |
unset($fields['billing']['billing_address_2']); | |
unset($fields['billing']['billing_postcode']); | |
unset($fields['billing']['billing_company']); | |
unset($fields['billing']['billing_city']); | |
$fields['order']['order_comments']['placeholder'] = 'We need you to type in the addresses here'; | |
$fields['order']['order_comments']['label'] = 'Be sure they are correct. Thanks!'; | |
return $fields; | |
} | |
//set the default quantity to one// | |
add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 ); | |
function jk_woocommerce_quantity_input_args( $args, $product ) { | |
$args['input_value'] = 1; | |
//Increment Buttons// | |
add_action( 'wp_enqueue_scripts', 'wcs_dequeue_quantity' ); | |
function wcs_dequeue_quantity() { | |
wp_dequeue_style( 'wcqi-css' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'wcqi_enqueue_polyfill' ); | |
function wcqi_enqueue_polyfill() { | |
wp_enqueue_script( 'wcqi-number-polyfill' ); | |
} | |
/* Custom Code to get WooCommerce One Page Checkout to work with The One Pager */ | |
class SG_OPC_Mods { | |
private static $modified_opc_properties = false; | |
public static function init() { | |
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'always_load_opc' ), 5 ); | |
add_filter( 'is_wcopc_checkout', '__return_true' ); | |
} | |
public static function always_load_opc() { | |
global $post; | |
if ( class_exists( 'PP_One_Page_Checkout' ) && false === PP_One_Page_Checkout::$add_scripts ) { | |
PP_One_Page_Checkout::$add_scripts = true; | |
PP_One_Page_Checkout::$shortcode_page_id = $post->ID; | |
PP_One_Page_Checkout::enqueue_scripts(); | |
self::$modified_opc_properties = true; | |
} | |
} | |
} | |
SG_OPC_Mods::init(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment