Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom price string on cart & checkout recurring totals sections #2

Open
3 tasks
thenbrent opened this issue Dec 6, 2018 · 5 comments
Open
3 tasks
Labels
enhancement New feature or request

Comments

@thenbrent
Copy link
Contributor

At the moment, the price string displayed is only for the product price. It would be possible to also apply that string to the cart & checkout recurring totals tool if:

  • we append some kind of extra group key to the recurring cart containing that product, like a sanitized version of the price string
  • add support for a variable in the string, e.g. {price}, so the same string can be used, but with tax, shipping etc. added to it by the cart
  • filter the cart & checkout strings for that recurring cart
@thenbrent thenbrent added the enhancement New feature or request label Dec 6, 2018
@melindahelt
Copy link

#3113894-zen requested

@bernattorras
Copy link
Collaborator

3332586-zen

@thuautp
Copy link

thuautp commented Sep 29, 2020

The customer in 3332586-zen shared their solution:

/**

* Subscription - change the FREE TRIAL pricing string in cart, checkout and elsewhere 30 sept 2020

*/

function wc_subscriptions_custom_price_string( $pricestring ) {

$pricestring = str_replace( 'free trial and', 'is pre-paid today via', $pricestring );

$pricestring = str_replace( 'with a', 'starting on the 15th of the month. Your first', $pricestring );

$pricestring = str_replace( 'sign-up fee', 'payment', $pricestring );

return $pricestring;

}

add_filter( 'woocommerce_subscriptions_product_price_string', 'wc_subscriptions_custom_price_string' );

add_filter( 'woocommerce_subscription_price_string', 'wc_subscriptions_custom_price_string' );

The outcome is this string appearing in the cart: Red is all the dynamic content.

$225.00 every 3 months starting on the 15th of the month. Your first 3-month is pre-paid today via a $225.00 payment

@ldr2273
Copy link

ldr2273 commented Apr 26, 2021

Another case is 29105259-hc

@dougaitken
Copy link
Member

3934883-zen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants