Revision: 66627
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 10, 2014 17:45 by daprela
Initial Code
/*
This function is a workaround for a bug of the subscription extension of WooCommerce.
If the subscription is set up as a variable product with monthly and yearly prices
the extension will show the wrong message, like '$10 - $120/month' instead of
'$10/month - $120/year'
*/
function replace_price_string() {
$first_price = WC_Subscriptions_Product::get_price('61842');
$first_period = WC_Subscriptions_Product::get_period( '61842' );
$second_price = WC_Subscriptions_Product::get_price('61844');
$second_period = WC_Subscriptions_Product::get_period( '61844' );
$subscription_string = 'From: $'.$first_price.'/'.$first_period.' to $'.$second_price.'/'.$second_period;
return $subscription_string;
}
add_filter('woocommerce_subscriptions_product_price_string', 'replace_price_string', '60697');
Initial URL
Initial Description
This function is a workaround for a bug of the subscription extension of WooCommerce. If the subscription is set up as a variable product with monthly and yearly prices the extension will show the wrong message, like '$10 - $120/month' instead of '$10/month - $120/year' Making the function general would have taken too long so I've simply hardcoded the product IDs
Initial Title
Woocommerce subscription variable products message error
Initial Tags
Initial Language
PHP