Skip to content

Instantly share code, notes, and snippets.

@lmartins
Forked from corsonr/gist:e5e5c5fc944c278049de
Created October 8, 2014 07:41
Show Gist options
  • Save lmartins/cc13a804a7bcea1bd1b0 to your computer and use it in GitHub Desktop.
Save lmartins/cc13a804a7bcea1bd1b0 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