We'd like to hook into pretty much all of the data structures of WooCommerce via webhooks, but can't seem to determine what are all the appropriate actions. We've seen the docs but if we simply pluck out all the "actions" we don't get everything we want (products / variants / orders being created / updated / deleted) and we do get a ton of stuff we don't care about (add to carts, etc)
Is there a better way of finding what the possible data-model oriented hooks are?
No, these are custom events configured as a do_action('some_action') function in your site.
Then you have to set the webhook action to some_action, and make the actions you need in your site.
See here for more info.
Related
I need to emit / send a custom event to Google Tag Manager when an order is eventually placed, so this order can be tracked.
The custom event should NOT be sent each time, when the WoocCommerce Thank you page is loaded, because the order would be tracked multiple times, when the page is reloaded.
So it should only be sent once for every order, when the final submit button is clicked AND the checkout form is valid.
I looked for wooCommerce DOM events, but couldn't found a suitable one...
I know there are plugins for that, but a plugin would be overkill for that I guess. We are a web agency and try to use as few plugins as possible and only necessary ones.
Unfortunately I have no clue, how I would emit an event on order placed... Any ideas or hints or even the solution to this? ;)
Thanks in advance, have a nice day
There are many solutions to this problem. As you mentioned, a plugin would be likely most suitable in the universe of Wordpress.
The next best solution is to open the documentation of woocommerce and see if you can find a callback for a successful order there. You emit an event from that callback if woocommerce doesn't do it already, which I believe you've checked.
Another solution would be sending the conversion on thank you loads, but have a logic in place that would not send more than one event with the same order id. And only when order id is defined. That would require you to surface the order id or find where it's surfaced.
A simpler yet dirty solution fitting woocommerce would be to just fire the conversion on the thank you page, but generate a cookie that would block the tag from firing again and let the cookie expire in N minutes, depending on whether you want to track repeated conversions from the same client.
I'm currently working on a multi STRIPE checkout for different STRIPE accounts based on the shipping country.
So far everything works smoothly by using the wc_stripe_params, wc_stripe_payment_request_params and woocommerce_stripe_request_headers filters and overloading the respective classes for the webhooks. There is one problem though.
Upon checkout page load, where the payment methods are, STRIPE renders CDATA values for their JS files.
When the initial shipping country guess through geoip database was correct and the customer doesnt change the shipping country, everything works fine, since the correct public keys were inserted into the JS of STRIPE. When the customer changes the shipping country there is no way to manipulate the already processed JS variables. This is why I want to split up the checkout process so that the last page is just for payment options based upon the before selected shipping country.
I know that there are multiple plugins for multi-step checkout available, but all use ajax for a smooth rendering, which results in the same error. I understand the way how to customize different processes in WP or WC, but I don't know how to really tackle this one since the formon the checkout page is posted to the wc_get_checkout_url() which needs payments selected and done - it doesnt look like there is a real multi step without ajax planned?
Thanks in advance for any help or thoughts
Problem solved by splitting up the checkout process into multiple forms and posting the data as one to the woocommerce checkout controller
i have project that i need to integrate tables in different structure of wordpress. i am want to use woocommerce plugin and make it work with product table. i still want to preserve all woocommerce logic and features.
when thinking about that all i want to do is changing the way i want to get the data, i mean to the query. my question is, if there is a way to implement it with kind of service.
i thought about serviece with functionality:
1.disable the post meta request- i am still trying to figure out how to do it.
2.trigger hooks once before the request to DB trigger - this is where i will convert the query wordpress/woocommerce logic created to new structure that will fit my tables structure.
3.trigger hook once after i get response from request where i will convert it to structure worpdress/woocommerce need for using the original flow.
how much it will be complicated and which hooks or filters should i use.
I am looking for an easy way to associate two products with each other on checkout while at the same time forcing the user to create the association if it doesn't exist yet. Basically, a user can by hosting, but in order to complete the checkout, they also need a domain name. I have classes for each, but I am trying to think of ways to solve two problems:
On checkout, display that two products are associated
Force the user to create the association
Any ideas on what I can use to do that?
UPDATE
What I did was:
Created two separate products
If you add the one, it does a check to see if this item has been linked to another product
If not, it takes you to a custom page forcing you to add and assign the other product
This works, but it's not very elegant. Any better suggestions would be much appreciated.
Use Rules to display messages to the user. Use the event on "add to cart", check the type of product, then check to see if the associated product is added to the cart, if not show message saying you also need to add a hosting package and auto redirect them there. Then upon checkout, check to see if one of those products exist, does the other exist in the cart? Throw same message and auto redirect them to the missing one.
You may need to use components with your rules to get the full effect. But that is what I would do.
I am new to Wordpress (using roughly 6 months) and just now getting into development when I decided I would attempt to replicate a project I have going currently and after reading multiple blogs regarding plugin development and custom post types, I am thoroughly confused as to which direction I should go. I am in need of creating a site that has back-end management (admin only) and then end-user management where the end-user should have a page that allows them to manage their items.
With custom post types, I am able to create the objects that I will need to use but that doesn't give me total control when it comes to allowing the end-user to modify them from a front-end interface.
With a plugin, I think I am able to create exactly what I need but not sure how to yet but at the same time, thinking through the structure of Wordpress, everything is basically a post, correct? So, if that's the case, my plugin would need to have the ability to register new custom post types. Does it sound like I am on the right track or am I way off here?
Custom Post Types can add a lot of power, especially if you dress up the Custom Fields with meta boxes. You can always use a role-scoping plugin to limit the access of end-users to only be able to use these Custom Posts and nothing else. CPT are a great way to handle inventory management and not rely on a plugin that will either cost $ or potentially break months down the road.
That said, many plugin you would find would most likely just create a Custom Post Type anyway. Take a look around on the codex for info on creating CPT, and if you're interested, look at jaredatch's work on Github.
http://codex.wordpress.org/Post_Types
https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress