Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
child functions.php 2
<?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
You can’t perform that action at this time.