I reviewed some articles (see below) and hope what I want to achieve is possible without too much coding (although I am aware some coding will be required).
I created a business listing post type and added a custom field "set-listing-as-featured" which is a checkbox, so if the user check this field when creating a business listing on the front, it should then open a conditional field where the user can select the duration of the featured post based on predefined dropdown selection of either 15, 30, 60 or 90 days.
These dropdown selection are each connected to a WooCommerce product and once the user submits the form, he will be redirecting to checkout to make the payment etc.
Let say the user selects 15 days, after these 15 days, the post should remain active but no more featured.
Any help about achieving this?
Is there any documentation that you are following?
Unfortunately you won't be able to dynamically set the expiration date of the post. My recommendation here is that you have multiple packages for the user that is available to select.
What will happen is that when the customer clicks on the package they want, it will take them to the form responsible for that package which would've had the form setup specifically for that package. So in your case you'll have 4 forms with the expiration and product price setup for each to match the 15, 30, 60 or 90 expiration.
Actually I don't want the post to expire after the X number of days, the post will remain active but just no more featured, which means that for example, if a user selects the 60 days featured for example, the post should remain featured for 60 days and after the 60 days the post will still be available but won't be featured anymore.
I don't mind creating multiple forms for each duration as you suggested but let say after the 60 days, the user wants to set the same post as featured again for another 60 days, will he need to submit a new post or just edit the actual post and pay again to have it featured again?
If the user will need to repost the post, this won't work for me as initial post should remain active and just the user can reset it as featured over and over again if and when he wishes, hope that make sense.