jeudi 28 janvier 2016

Woocommerce Subscription Strings

My site:

http://ift.tt/1NEbkXx

I have 3 subscription options:

  1. Monthly - Charged at $49.95 per month until customer cancels
  2. 3-Month - Charged $138.85 at signup and then $49.95 per month after those first 3 months have passed.
  3. 6-Month - Charged $274.70 at signup and then $49.95 per month after those first 6 months have passed.

Settings for (1) are straightforward. Simple $49.95 per month for all time.

Setting for (2 & 3) are:

$138.85 Signup Fee with a Free 3-month trial and then $49.95 monthly. For the 6-Month, it's $274.70 Signup Fee with a 6-month free trial and then $49.95 monthly.

It's the only way I could configure those settings for them to work the way I need them to.

Now, the 'woocommerce_subscriptions_product_price_string', 'my_subs_price_string' display info by default that's just downright confusing for my customers. So this need to be modified.

I managed to eliminate the displayed prices and strings on the Home Page with a filter (and I can live with that) but my problem is, that if a customer adds the item to their cart, those prices also don't display on the Cart Page.

Screencap: http://ift.tt/1TqtZ0t

So, even though this seems like a simple problem to solve, I can't get it done and need a bit of help.

The other alternative is to just display the subscription price on the Home Page. That however causes our Monthly option to display $0 since the settings that allow just the subscription price to display, is applied globally through the simple filter I'm using.

Targeting that by product (if possible) might solve it. But again, it's something that I'm having trouble with implementing.

The filter I'm using, I found here and it looks like this right now:

add_filter( 'woocommerce_subscriptions_product_price_string', 'my_subs_price_string', 10, 3 );

function my_subs_price_string( $subscription_string, $product, $include ) {

    /****
    var_dump($product); Various variables are available to us
    ****/

    return ' Renews at ' . wc_price( $product->subscription_price );
}

Obviously wrong as it stands. Help appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire