Skip Navigation

[Résolu] How can we add addtional prices on cred forms ?

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

Change the product ID when user submits the CRED form with CRED commerce settings.

Solution:

There isn't such a built-in feature within CRED commerce plugin, but you can try with some PHP codes, for example, when user submit the CRED form for creating the post, use action filter hook "cred_commerce_add_product_to_cart" to trigger your custom PHP function, in this function, change the product ID when specific condition is satisfied.

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/cred-commerce-api/#cred_commerce_add_product_to_cart

Filter that allows to dynamically alter the product associated with a CRED Commerce form, when adding to cart.

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.

Marqué : 

This topic contains 3 réponses, has 2 voix.

Last updated by Luo Yang Il y a 3 années et 5 mois.

Assigned support staff: Luo Yang.

Auteur
Publications
#710594

Tell us what you are trying to do?
Adding more price option on cred form.
Is there any documentation that you are following?
https://toolset.com/forums/topic/multiple-woo-commerce-products-in-cred-form-and-chck-out/

Hi,

Scenario:
Adding and editing listing posts via cred form. Need to add addtional prices.
1-Main Listing Price:
For examle theree month listing price is: 39 $ (cred form connected with woo product)
2-Additional Price (Three days - highligted )
Post will be highligted on homepage for three days( Featured category can be assigned automatically if this option also selected).
The total must be 42 $. But we conencted form with woocomerce product(39$) created before .
Also author shoul be able to select highligted option after published?

Listing will be published for 3 months also shown for 3 days as highligted at featured category on homepage.It will not be highlighted rest of publishing duration until author of listing edit to add a new 3 days highligted option.
We can show only one price on cred form. Is there any way to add more price option like main price connected woocommerce ?

How can we create option to add and edit additional price on cred forms which connected woocommerce?

My solution:
How does is it sound if I creted 2 forms which connected 2 seperated woocommerce products (39 $ and 3 $). One form for edit whole post and one for just selecting featured category. But the problem is duration of post. I don't know which one will be valid.
3 Months(main listing price) or 3 days(highligted) if author needs to edit his post ?

Solution Or your advice ?

Thanks

#713342

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

There isn't such a built-in feature within CRED commerce plugin, but you can try with some PHP codes, for example, when user submit the CRED form for creating the post, use action filter hook "cred_commerce_add_product_to_cart" to trigger your custom PHP function, in this function, change the product ID when specific condition is satisfied.

More help:
https://toolset.com/documentation/programmer-reference/cred-commerce-api/#cred_commerce_add_product_to_cart
Filter that allows to dynamically alter the product associated with a CRED Commerce form, when adding to cart.

#743216

Ok.Thanks

#746214

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

You are welcome