Alisa kh
Alisa kh

Reputation: 93

Displaying all custom fields

i have a problem which i dont know the best solution for it,

i have an online shop, and it has about 70 types of products, for example: phone , laptop , headphones etc ....

for each of the products i have set up advanced custom fields. for the laptop category i have fields like ram and screen display size and for the phone category i have: camera mega pixel, ram , color etc ...

i am using elementor pro to create the pages,

my question is : do i have to create a single product page in elementor for each of my product types to be able to dynamically show all custom fields for each product type? i mean one template for the phones , one template for the headphones and one template for all the laptops

or is there an easier way just to make one product template and show all custom fields related to that product by a plugin or something?

i have already viewed all the articles and youtube videos i could find but the all teach how to add it for one type of product not for all products

Upvotes: 0

Views: 152

Answers (1)

Nicholas Panarelli
Nicholas Panarelli

Reputation: 150

If you want one single template with all the fields that shows only the ones filled in the product page you could use the Dynamic Visibility for Elementor plugin.

It let's you display a field dynamically if it has or has not a value. Once you install it you will see an additional tab on the editor, then you can set all the widgets that display the custom fields like this:

enter image description here

Then in dynamic tags select the custom field and set click on not set or empty:

enter image description here

Now the widgets that display the custom field content will show in front end only if there's content in the custom field.

The other way is indeed to create specific category/tag for each product typ, so Phones, Laptops, Headphones, ect... and then flag the respective products with that category or add the tag.

Then in Templates >> Theme builder create a single product template, then when you publish it in the conditions set "In category" and select the desired category. Do so for each category.

For the custom fields you can put a simple text field and then use the dynamic tags options to show the content form a custom field selecting ACF Field.

enter image description here

See more here:

Elementor Integration With ACF

How to use Elementor with ACF Tutorial

Hope it helps

Upvotes: 1

Related Questions