Skip to main content

Hi FluentCart Team,

I'm currently testing FluentCart before purchasing it and integrating it with Etch.

When a subscription is cancelled, attributes like expire_at return null, which makes it difficult to determine whether the user should still have access during the remaining billing period.

I temporarily used created_at, but this is not reliable for multi-year subscriptions or different billing cycles.

What is the correct way to programmatically detect if a cancelled subscription is still within its valid access period?

Thanks in advance.

add_filter('etch/dynamic_data/user', function($data, $user_id) {

    $customer = \FluentCart\App\Models\Customer::where('user_id', $user_id)->first();

    if (!$customer) {
        $data['subscriptions'] = [
            'has_subscription' => false,
            'has_valid_access' => false
        ];
        return $data;
    }

    $subscriptions = \FluentCart\App\Models\Subscription::where('customer_id', $customer->id)->get();

    if (!$subscriptions->count()) {
        $data['subscriptions'] = [
            'has_subscription' => false,
            'has_valid_access' => false
        ];
        return $data;
    }

    $active_subscription = \FluentCart\App\Models\Subscription::where('customer_id', $customer->id)
        ->where('status', 'active')
        ->first();

    $formatted_subscriptions = [];
    $has_valid_access = false;

    foreach ($subscriptions as $subscription) {

        $expires = null;
        $status  = strtolower($subscription->status);

        /* ACTIVE */
        if ($status === 'active') {
            $expires = true;
            $has_valid_access = true;
        }

        /* CANCELLED */
        elseif ($status === 'cancelled' || $status === 'canceled') {

            if (!empty($subscription->created_at)) {

                try {

                    if ($subscription->created_at instanceof \DateTimeInterface) {
                        $created = clone $subscription->created_at;
                    } else {
                        $created = new \DateTime($subscription->created_at);
                    }

                    $expiry = clone $created;
                    $expiry->modify('+1 year');

                    $now = new \DateTime();

                    $is_valid = $now < $expiry;

                    $expires = [
                        'valid' => $is_valid,
                        'date'  => $expiry->format('Y-m-d H:i:s')
                    ];

                    /* Valid access */
                    if ($is_valid) {
                        $has_valid_access = true;
                    }

                } catch (\Exception $e) {
                    $expires = null;
                }
            }
        }

        /* Other status */
        else {
            $expires = null;
        }

        $formatted_subscriptions[] = [
            'id'      => $subscription->id,
            'status'  => $subscription->status,
            'plan'    => $subscription->plan_id,
            'expires' => $expires
        ];
    }

    $data['subscriptions'] = [
        'has_subscription' => true,
        'items'            => $formatted_subscriptions,
        'is_active'        => !!$active_subscription,
        'has_valid_access' => $has_valid_access
    ];

    return $data;

}, 10, 2);

Anyone have a full online store running, and actively making money with FluentCart? I would love if you could share! Need some inspiration.

do yourself a favour and give smithyfactory a follow on Facebook, Mikes currently building out a full toolkit for Fluent Cart for Breakdance page builder….

https://www.facebook.com/share/v/18L2WpXP2X/?

Hello there,

I would love to know if i can have a costum product page.

With the full width fluent community layout.

I see the video dont show every screen. But hope you understand.

https://www.loom.com/share/9c2f6f039fa646afb1b4790aa5479d31

Hi.. I have a WP site using the free version of Elementor. Does FC support Elementor? I can see the FC widgets with the WP basic editor but not using Elementor. I simply want to duplicate the following popup cart function from a simple button created by: Natascha VantuykomΒ  with her example here: https://lgdlitedemo.myob.be/landingspagina/

Secondly, does FC support video in the product gallery? I added a video but it didn't work. Are other plugins needed to use a video in the FC product gallery. Any links to instructions would be amazing .. thanks in advance and a big sunshine smile from South Beach to all of youΒ 

Is it possible to change the text in the checkout? It says "Per years until cancel"
Maybe I wrote it myself, I don't remember, but I suspect its hard coded and I can't find where that might be.

Modify Checkout Text?

What happens if someone signs up for a 1 year membership/subscription, and they cancel on day one (they paid and don't ask for a refund)?

Do they lose access to the download files or tag based membership access on the day they cancel or one year later?

Please enhance the Agree Terms box with the same sort of formatting controls available in the product description boxes. I experimented to find you can manually write HTML code in this box, but facilitating formatting and hyperlinks here would be a great convenience. thank you

I operate two related websites, for the same brand. Can I keep Fluent Cart on Site 1, but put checkout buttons or product listings on site 2, and then run checkout and delivery from site 1? Is there a best practice for doing that?

(site 1 has fluent cart plus fluent community for courses on it, site 2 is the public-facing site with about, services, contact, blog, etc)

Have you experienced this?

If you go here, the 3-pay button shows the 1-pay version:
https://learn.parishealingarts.com/metabolic-health-group/

But if you go here, the product page has both payment options, and they work correctly:
https://learn.parishealingarts.com/item/metabolic-health-reset/

Β One thing I notice: the instant modal button has item_id=1 for both payment options, and no other signifier of payment type.

Yet I have very carefully chosen the 3-pay variant on the 3-pay button. I've created that button from scratch several times.

Pro version 1.3.10