• Resolved JboyJW

    (@jboyjw)


    Oh no! I used your plugin soon after you released the variable subscription support. Everything looked great! But now that a month has gone by, there are some older subscriptions that are renewing now and when the subscriptions include products with old variation combinations, those products are being charged at $0.

    So it appears that your plugin looks for a variation and grabs the new price and updates the subscription, which is great, but it needs to be updated so that if it comes across a variation combination that no longer exists, that the price stays the same and does not become $0!

    I’m trying to look at your code to figure out how I can manually go into the database to update these one-offs but it’s not immediately obvious… Is there a magical select statement that you know that I can see all of the subscription product variations that are 0?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author moiseh

    (@moiseh)

    Hello,
    I think you can look at the wp_woocommerce_order_itemmeta table, for example:

    select * from wp_woocommerce_order_itemmeta where meta_key='_line_subtotal' and meta_value='0';
    select * from wp_woocommerce_order_itemmeta where meta_key='_line_total' and meta_value='0';

    Hope it helps

    Thread Starter JboyJW

    (@jboyjw)

    Thanks moiseh.

    For those that may be helped by this, here’s a more complete query that lets you know the Subscription ID, the status of the subscription and you can add whatever variation meta values you’d like to compare (we have one called Subscription Type) to make it easy to find the offending subscriptions.

    SELECT oi.order_id, p.post_type, p.post_status, oim.meta_value, oim2.meta_value
    FROM wp_woocommerce_order_items oi
    INNER JOIN wp_posts p ON p.ID = oi.order_id AND p.post_type='shop_subscription'
    INNER JOIN wp_woocommerce_order_itemmeta oim ON oim.order_item_id = oi.order_item_id
    INNER JOIN wp_woocommerce_order_itemmeta oim2 ON oim2.order_item_id = oi.order_item_id AND oim2.meta_key='subscription-type'
    WHERE oim.meta_key='_line_total' AND oim.meta_value='0'

    Tried to update the meta_values of line item directly in the database, but it doesn’t update the calculation of the subscription… So it seems the easiest way is to manually go into each subscription, remove the old variation and add the updated one.

    moiseh, I recommend that you put a notice in the description of your plugin that you must first make sure that all subscriptions contain up to date product variations, because old variations will become $0 in the subscription.

    Plugin Author moiseh

    (@moiseh)

    Hello Sir,

    Thanks for the inconvenience. I’ve tried to reproduce this but woocommerce don’t let me to exclude variations associated with subscriptions. But hope this doesn’t happen anymore in new versions.

    Also updated the FAQ with the recommendations to make a backup before do updates with this plugin.

    Thanks

    Thread Starter JboyJW

    (@jboyjw)

    Unfortunately a backup doesn’t help when the issue isn’t necessarily apparent until a few weeks after when $0 renewals go through. Too late to revert to a backup.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Variable Subscriptions Issue’ is closed to new replies.