fbpx

Feature Requests

Got an idea for a new feature or integration? We’d love to hear it! You can find our roadmap here.

5 votes

Advanced Custom Fields Integration

Advanced Custom Fields (ACF) Integration; specifically so that I can build a product page template in Elementor, and then show/hide various widgets/elements on the page based on user tags.

USE CASE:

I’d like to be able to hide the “Add to Cart” widget from a product page if the logged in user already has the tag associated with that course, and instead show a paragraph and button like:

“You already own this course. Visit your ‘My Courses’ page to continue learning”

How I imagine this working is similar to dynamic tags for text elements (see screenshots). With text, you can dynamically show whatever is set up in the back-end product set up inside an ACF field. And then while the template remains the same, depending on which product is being viewed, different text will appear to the user.

So in this case, in the Advanced > WP Fusion box inside Elementor, there could be an option to use “dynamic tags” instead of the same tag no matter the user. And then in the product page where we add all the info about price, etc, we could add the tag for this specific product.

Then if the user visiting that product page has that tag, instead of being able to see the “add to cart” section, they see the message to go to “My Courses” instead.

Hope that makes sense. I think there would be a lot of other cool use cases for this kind of feature.

Thanks for your epic plugin. We couldn’t have the website we do, without WP Fusion!! You rock 🙂

Attachments
Declined Category: Plugin Integrations Megan Marais shared this idea Updated: June 17, 2022

5 thoughts on “Advanced Custom Fields Integration”

  1. Hey Megan, thanks for the idea!

    I can see how this would be useful, but Elementor doesn’t support us adding dynamic properties to the Select Tags dropdowns. We could probably hack it together and make it work, but then it would also probably break with Elementor updates…. which is no fun for anybody.

    I think for this a better option would be to use the wpf_elementor_can_access filter (https://wpfusion.com/documentation/filters/wpf_elementor_can_access/), and then you can use that to read the required tags off of the underlying post.

    Those could either be the tags from the main WP Fusion metabox (using wp_fusion()->access->get_post_access_meta( $post_id ); ), or tags saved in an ACF field. Whatever you like.

    That will give you the most flexibility and you can be sure it won’t break with Elementor updates.

  2. Hi,
    I was thinking the same thing about this feature when I found this post.
    My usage is similar to Megan’s.
    I have several custom post types, such as Lesson, Class, and Instructor.
    Each of the courses is connected to a membership, and users are tagged based on their membership.
    Now when we want to play with visibility on these custom post types, we have to use fixed tags that have to be manually modified with each addition, subtraction, or change of access.
    And also when we want to create a loop on these custom post types, the same problem manifests itself in a different form.

    Jack, can you explain more about how to solve this problem using wpf_elementor_can_access?

    1. Hey Mohammad,

      There are two possible ways to solve this.

      One is a new feature we’ve added where Elementor templates and loops can inherit access rules from their underlying content. For example you could build a Class template which is dynamic for each class based on the access tags configured for that class: https://wpfusion.com/documentation/getting-started/access-control/

      That new feature is at https://wpfusion.com/documentation/page-builders/elementor/#inheriting-access-rules-from-posts

      That may work if the content is protected by the same tags that are granted by the membership, but if you want to fully control the access rules, we have some examples of the wpf_elementor_can_access filter at https://wpfusion.com/documentation/filters/wpf_elementor_can_access/#create-a-custom-access-rule-for-a-specific-element

      1. Thanks for your quick reply, I appreciate it.
        Yes, I have checked this new feature, if I’m correct, to use underlying post access, I have to use one of the default WordPress Fusion methods to restrict access to casses or courses, such as redirecting or restricting the page content and showing a restricted content message.
        But I don’t want to restrict access to the entire page, but I have a template that I want to restrict the elements inside based on user tags.
        I think this feature can’t achieve my goal. Please tell me if I misunderstood.

        I also saw the example of using wpf_elementor_can_access and I want to explain to you one of the methods that I can think of that can meet this need, and if you have any tips, you can guide me.

        On the class or course template page, you create two general containers and use one to create the version you want to show to members, and the other for those who haven’t purchased the course.
        Then you somehow find the ID of each container and use it to manage access to each container using the method mentioned in the wpf_elementor_can_access example.

        1. Yes exactly, that would work. You could create two containers and then publish the page. You can inspect the HTML of the page to find the container IDs, and then use these in wpf_elementor_can_access filter to create your custom access rules.

          ChatGPT is actually pretty well trained on the WP Fusion documentation and can usually come up with the correct code on the first try, especially with the 4o version.

Leave a Comment

Your email address will not be published. Required fields are marked *