Skip Navigation

[Résolu] Integration of Custom Post type and Woocommerce

This support ticket is created Il y a 6 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Beda Il y a 6 années et 3 mois.

Auteur
Publications
#1086524
error5.png

It would be great if you can give suggestions. Below is the scenario what I want to do.
1) There is one custom post type called "Obituaries".
2) Using Woocommerce Product functionality I am creating flower shop.

I want to map Obituaries and Flowers. Guest user can send flowers to specific Obituaries.

I have created Obituaries and Flower shop. Now only integration is left. How can i set flower send detail to specific Obituaries?

Please find an attachment to get idea about the view of my page.

#1086542

Toolset forms can interact with Products of WooCommerce in this way:

- when a post or user is created or edited, a Product (one) can be bound to the action so that when the user submit the form, the user needs to purchase that product bound to it.
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/

So, you could let the user (guest) EDIT a actual Obituary.
The user would not see any fields in the Form (remove them) but only the Submit Button and a select Field that you set up with below instructions:
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/#2-1-product-to-buy

The user will choose the product to buy from the field, submit the form, and pay the product.

Now you will receive a notification (can be added to the Form) that tells you someone just edited post xy (the obituary) and purchased product xy (flower)
Fromt there you should be able to make sure the correct flowers are sent to the right obituary.

However, this is a bit cumbersome in the approach, as you maybe want to send many flowers AT ONCE to the same obituary and that wouldn't be possible in this case (unless you offer some flower packages, maybe, bundled in one product).

Now, a better approach could be to not use the Forms Commerce logic above, but only WooCommerce logic.

WooCommerce has natively already what you need:
the delivery / shipping address.

So, if you could update that with the data you have in your Obituary posts, then that would do the trick, right?

You can:
lien caché

Basically you will use that code to update the shipping address of the order by WooCommerce.
The code sample there does that when the user saves his/her address on checkout:
woocommerce_customer_save_address
It then updates _billing_ data in the sample code, but WooCommerce APU should as well allow to do this when the order is completed and allow to update the shipping data.
https://stackoverflow.com/questions/45967123/updating-client-woocommerce-shipping-address-before-checkout-page