Skip to content

Instantly share code, notes, and snippets.

@oterox
Last active June 13, 2016 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oterox/1c04d08c8e2b2ad820276d3e1ead6344 to your computer and use it in GitHub Desktop.
Save oterox/1c04d08c8e2b2ad820276d3e1ead6344 to your computer and use it in GitHub Desktop.
woocommerce snippets
<?php
add_filter('add_to_cart_redirect', 'themeprefix_add_to_cart_redirect');
function themeprefix_add_to_cart_redirect() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
return $checkout_url;
}
//Add New Pay Button Text
add_filter( 'woocommerce_product_single_add_to_cart_text', 'themeprefix_cart_button_text' );
function themeprefix_cart_button_text() {
return __( 'Pay Now', 'woocommerce' );
}
add_filter ('woocommerce_add_to_cart_redirect', 'woo_redirect_to_checkout');
function woo_redirect_to_checkout() {
$checkout_url = WC()->cart->get_checkout_url();
return $checkout_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment