Skip to content

Instantly share code, notes, and snippets.

@mattpramschufer
Created February 14, 2018 14:51
Show Gist options
  • Save mattpramschufer/d308b6eab561da2f13c0a941de05ffcd to your computer and use it in GitHub Desktop.
Save mattpramschufer/d308b6eab561da2f13c0a941de05ffcd to your computer and use it in GitHub Desktop.
Modify WooCommerce Subscriptions Subscription Strings
<?php
add_filter('woocommerce_subscriptions_product_price_string', 'modified_subscription_strings', 10, 3);
function modified_subscription_strings($subscription_string, $product, $include){
switch($product->get_slug()){
case 'green-magazine-subscription':
case 'classic-farm-tractor-subscription':
case 'little-green-magazine-subscription':
return '$' . number_format($product->get_price(), 2, '.', '') . ' / year';
break;
default:
return $subscription_string;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment