• Hi Team

    Love the Product dependencies so far but I am planning to start selling descriptions. Some of my products depend on a valid subscription. Does your plugin support subscriptions and if so which subscription plugin is recommended.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jason Kytros

    (@jasonkytros)

    Hey @basdebruin,

    Thanks for reaching out!

    As far as we understand, you’d like to prevent customers from purchasing a specific product if they haven’t previously purchased a Subscription product. Is that right?

    If so, then this is definitely possible by using Product Dependencies together with the official WooCommerce Subscriptions extension.

    Let us know how this goes!

    Cheers,
    Jason Kytros
    Support Engineer

    SomewhereWarm SMPC
    https://somewherewarm.gr/

    Hi Jason,
    I have a similar query, but I want to check if the user has an active subscription when they try to purchase the follow on product, not just whether they might have purchased a subscription in the past and since cancelled it. Does this plugin have that capability to check that condition $has_sub = wcs_user_has_subscription( ”, ”, ‘active’ );? Thanks

    Guess would use this sort of code:

    /**
    * Check if a user has a subscription, optionally to a specific product and/or with a certain status.
    *
    * @param int $user_id (optional) The ID of a user in the store. If left empty, the current user’s ID will be used.
    * @param int $product_id (optional) The ID of a product in the store. If left empty, the function will see if the user has any subscription.
    * @param mixed $status (optional) A valid subscription status string or array. If left empty, the function will see if the user has a subscription of any status.
    * @since 2.0
    *
    * @return bool
    */
    function wcs_user_has_subscription( $user_id = 0, $product_id = ”, $status = ‘any’ ) {

    $subscriptions = wcs_get_users_subscriptions( $user_id );

    $has_subscription = false;

    if ( empty( $product_id ) ) { // Any subscription

    if ( ! empty( $status ) && ‘any’ != $status ) { // We need to check for a specific status
    foreach ( $subscriptions as $subscription ) {
    if ( $subscription->has_status( $status ) ) {
    $has_subscription = true;
    break;
    }
    }
    } elseif ( ! empty( $subscriptions ) ) {
    $has_subscription = true;
    }
    } else {

    foreach ( $subscriptions as $subscription ) {
    if ( $subscription->has_product( $product_id ) && ( empty( $status ) || ‘any’ == $status || $subscription->has_status( $status ) ) ) {
    $has_subscription = true;
    break;
    }
    }
    }

    return apply_filters( ‘wcs_user_has_subscription’, $has_subscription, $user_id, $product_id, $status );
    }

    • This reply was modified 4 years, 6 months ago by dubaidogfish.
    • This reply was modified 4 years, 6 months ago by dubaidogfish.
    Plugin Author Jason Kytros

    (@jasonkytros)

    Hey @dubaidogfish,

    Thanks for getting in touch!

    I have a similar query, but I want to check if the user has an active subscription when they try to purchase the follow on product, not just whether they might have purchased a subscription in the past and since cancelled it.

    Product Dependencies does not include any options that check if customers have an active Subscription — only if they have previously purchased a Subscription product.

    We know that WooCommerce Memberships allows you to restrict content and/or access to specific products based on a customer’s Subscription status. You can read more about this at: https://docs.woocommerce.com/document/woocommerce-memberships-subscriptions-integration/#section-3.

    Would you perhaps consider using this extension for this case?

    Cheers,
    Jason Kytros
    Support Engineer | SomewhereWarm SMPC | https://somewherewarm.gr/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is Product Dependencies compatible with Subscriptions’ is closed to new replies.