How to add webhook action for woocommerce shipment tracking plugin? - woocommerce

I am using official 'Woocommerce Shipment Tracking' plugin. I want to add webhook event to fire whenever a tracking number is added to order. I have tried adding wc_shipment_tracking_items, wc_shipment_tracking_save_form, woocommerce_shipment_tracking to action in webhook but its not firing any webhook.
Also, official documentation says it support rest api but doesnt mention any webhook action events.
Hence i am posting this topic here in hope of getting some help.

Related

Prevent WooCommerce from firing product update webhook on REST API update only

I am trying to create a stock sync system that communicates with WooCommerce via REST API and webhooks. It works simply like that:
If the product was updated - the webhook is fired to my API which creates the event with the current stock information.
When event is created it is being processed and the product update information is sent via REST to other WooCommerce stores in my "network". The product is updated.
The issue here is that it creates some kind of infinite loop as when the product is updated on other website it fires webhook again and creates a new event in my API again.
Question: Is it possible to prevent WooCommerce from firing product update webhooks ONLY when product is updated via REST API (or specific function)?
Yes, there is an example using the filter woocommerce_webhook_should_deliver here: https://shanerutter.co.uk/fix-woocommerce-webhook-loop/
Also, I've had luck un-scheduling the Action Scheduler actions upon their creation, which is a consequence of a REST API inventory type sync job firing product updated hooks and web hooks:
add_action( 'init', function() {
as_unschedule_all_actions( 'adjust_download_permissions' );
} );

Custom PayPal Checkout for subscription plan

I want to build a custom PayPal checkout for a single product (subscription plan).
On successful purchase I need to save the current date +30 days to the user profile as well as upgrade the user role to "premium". This part is no problem but I'm having trouble finding how and what I need to use from PayPal.
Could someone point me in the right direction? Is the PayPal IPN service still a thing, or is it legacy?
I checked out some PayPal WordPress plugins but they offer too much esp. an own member solution or integration with WooCommerce, which I don't need. I only need a plugin that handles the checkout and gives me the chance to hook some custom actions on some events for example the successful purchase.
There's no reason to use something old like PayPal IPN. Use the current Subscriptions API, and webhooks for event notifications.
Subscriptions are documented here: https://developer.paypal.com/docs/subscriptions/integrate/
And to subscribe to webhooks for later event notification, see webhook event names for subscriptions.
The Webhook documentation mentions using REST SDKs. Those SDKs are deprecated, use HTTPS API calls.

How can I set callback URL for PayPal gateway on WooCommerce?

I'm trying to set a callback URL to send the order data to a specific URL if payment is paid and etc..but I must that it will come same as it sent from PayPal IPN
The standard WooCommerce module already uses IPN for processing, and only one IPN can be sent -- so replacing or overriding that IPN would not be a good idea. There is a newer/better WooCommerce plugin for PayPal available, which is not so dependent on IPN, so maybe switch to that: https://woocommerce.com/woocommerce-and-paypal/
And separately from IPN, you can subscribe to Webhook events for PAYMENT.CAPTURE.COMPLETED and etc.
Webhooks are documented here: https://developer.paypal.com/docs/integration/direct/webhooks/

Prestashop - Send an order event in Google Analytics

I'm developing a Prestashop e-commerce and I want integrate it with Google Analytics.
I've created a OrderConfirmationController.php override that provides the order data I want to send to Google Analytics.
Then, in order-confirmation.tpl I'm sending the Analytics event with the Tag Manager code.
It's working almost fine, because most of the users keep tracked. But I see there are orders that aren't being tracked. Maybe when a users pays with PayPal they can exit the browser and Prestashop doesn't render order-confirmation.tpl (so the event is not sent).
Where is the correct place to send the event?
Thank you, greetings.
You need to use hook actionObjectOrderAddAfter which is called after an order creation and has all necessary information about the order.
public function hookActionObjectOrderAddAfter($order)
{
// $order is an object
your code here
}
I cannot check exactly your PayPal module but I think it should work

Woocommerce order update webhook not firing

I am using woo commerce and I have been looking at the webhooks.
All of them have logs (aka they have been firing)
However, the order.updated webhook is the only one which does not have any logs.
Can anybody help me? I have contacted woo themselves and have not had a response + checked many many threads but there does not seem to be a clue anywhere.
Thanks.
Dan
Have tried your approach created a Webhook with the order.updated as action.
Now ordered a product. And did the following
Changed the status from the following buttons.
But the webhook didn't fired at all.
Then went to the respective order and added some custom field value and clicked on save order.
Then checked the Webhook log. Yes for this above action a webhook triggered.
Now i tried with changing the status of the order from the order edit page itself.
Here changed from processing to on-hold status and did save order.
(Status processing was set previous while trying to update status from the order list dashboard itself.)
Again checked the webhook log for the same.
Yes and now the webhook had one more trigger logged in it.
Finally got to a conclusion that this order.updated action is triggered when any changes are made and saved view the editing the single order page.
A Collaborator has suggested to use action.woocommerce_order_status_changed instead.
In my case the cron-jobs were deactivated, due to an Error of our hosting provider.
The cron jobs can be viewed using this URL. Over the GUI i could not find the cron Job page.
https://{yourDomain}/wp-admin/tools.php?page=action-scheduler&status=past-due&order=asc&

Resources