Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

freddyheppell's avatar

Change default plan

Right now, the default plan on the register page is the first paid plan that I have. I want to make it so that the free plan is selected. The logic for this isn't in a component file, it's in mixins/register.js, so it can't be overridden using the method described in the docs.

I tried adding code to re-select the free plan in resources/assets/js/spark-components/auth/register-stripe.js, but this executes before the plan selection logic as it retrieves the plan list via ajax first.

How can I do this without directly editing the code?

0 likes
3 replies
tptompkins's avatar

Did you ever figure this out? I'm in a similar boat where I'd like to have a free plan with no trials and have the free plan be selected by default after registering.

freddyheppell's avatar

I never did. The problem lies in making it run after the list is retrieved and the default logic is run, which I can't see any way of doing.

EventFellows's avatar
Level 16

I needed this, too. Here is how it works and how it can be solved.

How it works:

there is a selectAppropriateDefaultPlan()-method in the vendor\laravel\spark\resources\assets\js\mixins\register.js file that is responsible for selecting the default plan.

        /**
         * Select the appropriate default plan for registration.
         */
        selectAppropriateDefaultPlan() {
            if (this.monthlyPlans.length == 0 && this.yearlyPlans.length > 0) {
                this.showYearlyPlans();
            }

            if (this.query.plan) {
                this.selectPlanByName(this.query.plan);
            } else if (this.query.invitation) {
                this.selectFreePlan();
            } else if (this.paidPlansForActiveInterval.length > 0) {
                this.selectPlan(this.paidPlansForActiveInterval[0]);
            } else {
                this.selectFreePlan();
            }
        }

As it is not such a good idea to overwrite it in the vendor files I edited my \resources\assets\js\spark-components\auth\register-stripe.js - because I use stripe.

As far as I understand that is the intended way of overwriting spark .js methods - correct me if I am wrong!

So now it looks like this:

var base = require('auth/register-stripe');

Vue.component('spark-register-stripe', {
    mixins: [base],

    methods: {

        /**
         * Select the appropriate default plan for registration.
         * Partially overwriting laravel\spark\resoures\assets\js\mixins\register.js to set free plan as default plan
         */
        selectAppropriateDefaultPlan() {
            this.selectFreePlan();
        }
    }            
});

Don't forget to run GULP - and it shoud work.

That's it. (you must have a free plan as it is now hardcoded as default)

5 likes

Please or to participate in this conversation.