I'm building a directory website, and the clients will be able to add their listing by choosing between 3 packages: Free, Standard, Premium. I plan on using WooCommerce Subscription to achieve that.
Each package will show different fields on the frontend, ie. Free Listings will show only the basic info (ex. 4 of 10 custom fields), Standard Listing should display a bit more (ex. 7 of 10 custom fields) and the Premium Listing will show all the fields. Also, I want to have a sidebar on the right side, for the Standard and Premium there will be a contact form, and for free listing will be AD (all created in elementor).
I created a products (Free, Standard, Premium), and I was able to connect Post Form for each, but I'm still searching for the best solution regarding the preview of the Listing itself.
Should I create 3 post types (1 for each package) or there's a better way to that?
I use Toolset and Elementor for styling, and WooCommerce for Subscriptions.
So in sum, I want to display different fields on the listing page, based on the subscription plan the client purchased.
Please let me know of the best way to achieve that.
I'm still not sure how to assign a new user roles to a specific subscription package?
I was able to add conditional block and make a new user role with Access Control, but default Subscription role is Subscriber and I don't know where to add/assign additional role that I made (ie. Free Subscriber) and how to assign it to a specific package?
Also, can you please help me understand the toggle "not" in conditional block - it's very confusing ux. If the toggle is active, does that mean the element in condition block WILL be displayed, or not?
I'm still not sure how to assign a new user roles to a specific subscription package?
I was able to add conditional block and make a new user role with Access Control, but default Subscription role is Subscriber and I don't know where to add/assign additional role that I made (ie. Free Subscriber) and how to assign it to a specific package?
==>
how exactly the user is going to buy your subscription?
Also, can you please help me understand the toggle "not" in conditional block - it's very confusing ux. If the toggle is active, does that mean the element in condition block WILL be displayed, or not?
==>
The "NOT" button is for applying the negation. so lets say if you want to check for NOT empty then you can add the condition for empty and then activate the NOT button so that means not empty.
---- how exactly the user is going to buy your subscription?
So what I did is - I created 3 post forms, one for each subscription (free, standard, premium) and each of them has a different number of fields. I placed the forms in 3 different content templates that I later assigned to a specific package - that way each package the customer selects to purchase will redirect to filling the post form that is assign to it, and will display only those fields in the frontend - that was the best solution I could find for that purpose. I added an image of how I connected the post form - content template - package.
So after purchasing the package, based on the docs you sent and WooCommerce docs, all users will have the same, default user role (image attached).
This means having conditional blocks checking for a user role won't work, if all the user roles are "subscriber".
The particular problem I'm having right now is that I want to display a gallery for Standard and Premium packages, but for Free Listings it should be only a default background image instead of thee gallery. The second thing is a sidebar - Standard and Premium should have a contact form, and Free Listings only an ad.
I can see the following hook: woocommerce_subscriptions_updated_users_role
Description:
When a subscription is activated, suspended, cancelled or expired, the user’s role will also be changed, which triggers the 'woocommerce_subscriptions_updated_users_role' hook.
What if you try to use the above hook to assign your desired role when user create new subscription or check with WooCommerce Subscription support if they have any other hook to suggest that would work better in your case.
We can also use other WooCommrece order related hooks like woocommerce_thankyou or woocommerce_order_status_processing but its better to check with WooCommerce Subscription support so you will have exact idea what hook to use.