Skip Navigation

[Resolved] How to set WooCommerce Product Gallery with CRED?

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 7 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#474120

I am trying to: create a new product and set the Product Gallery with CRED

I visited this URL: https://toolset.com/documentation/user-guides/creating-woocommerce-products-using-cred-forms/

I expected to see: how to set the Product Gallery with CRED

Instead, I got: just a message that says "Product Gallery needs to be saved using a CRED hook. If you need a non-code solution, add product images using custom fields defined in Types."

I didn't find any information regarding that "CRED hook" and the type of field that I should use (an Image repeater field maybe?)

I need to use the WooCommerce field, I must not create a custom field. I can manage some PHP without problem. I have no problems with the other fields of the product at the moment.

#474353

Dear stefano,

Yes, it needs custom PHP codes, for your question:
I didn't find any information regarding that "CRED hook" and the type of field that I should use (an Image repeater field maybe?)

You can try with CRED action hook:
cred_save_data
This hook allows doing a custom action when post data is saved to database.
https://toolset.com/documentation/user-guides/cred-api/#csd

Yes, I agree with you that an Image repeater field is better for this case.

And in the database , Woocommerce plugin is using a custom field "_product_image_gallery" to store the media IDs.

For your reference.

#475243

Now the problem is that I can't find out how to create a generic repeater field. If I click on "add generic fields" and then on "Image", I don't have any option that allows me to set the field as a repeater. How can I do that?

#475594

There isn't such a feature that can create a generic repeater field. see our document:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_generic_field

I suggest you create a custom repeating image field:
https://toolset.com/documentation/user-guides/displaying-wordpress-custom-fields/repeating-fields/
Put it into your CRED form for user to submit images, after user submit the form, use action hook cred_save_data to store them as "Product Gallery"

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.