Created
September 9, 2013 21:48
-
-
Save jwebcat/6501993 to your computer and use it in GitHub Desktop.
Override Woo Commerce Add to cart and go straight to checkout page. Also, override fields comments field Checkout page.
This file contains hidden or 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
add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); | |
function redirect_to_checkout() { | |
global $woocommerce; | |
$checkout_url = $woocommerce->cart->get_checkout_url(); | |
return $checkout_url; | |
} | |
add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text'); | |
function woo_custom_cart_button_text() { | |
return __('Donate Now', 'woocommerce'); | |
} | |
// Hook in | |
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
// Our hooked in function - $fields is passed via the filter! | |
function custom_override_checkout_fields( $fields ) { | |
$fields['order']['order_comments']['placeholder'] = 'Order Comments'; | |
$fields['order']['order_comments']['label'] = 'You will receive a donation substantiation letter directly from Infinite One Ministries. All donations are tax deductible to the extent allowed by law. Infinite One Ministries has submitted its 1023 application to the IRS to become an approved 501c3 entity. Our EIN number is 45-2959586'; | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment