Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created June 17, 2014 13:11
Show Gist options
  • Save corsonr/e5e5c5fc944c278049de to your computer and use it in GitHub Desktop.
Save corsonr/e5e5c5fc944c278049de to your computer and use it in GitHub Desktop.
WooCommerce Subscriptions: edit sign-up button text
<?php
function woocommerce_custom_subscription_product_single_add_to_cart_text( $text = '' , $post = '' ) {
global $product;
if ( $product->is_type( 'subscription' ) ) {
$text = get_option( WC_Subscriptions_Admin::$option_prefix . '_add_to_cart_button_text', __( 'Sign Up Now', 'woocommerce-subscriptions' ) );
} else {
$text = $product->add_to_cart_text(); // translated "Read More"
}
return $text;
}
add_filter('woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_subscription_product_single_add_to_cart_text', 2, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment