You can use the woocommerce_order_status_changed action to find a failed order transition, and syslog to write your log, assuming the function is not disabled in your PHP configuration.
add_action( 'woocommerce_order_status_changed', function ( $order_id, $old_status, $new_status ) {
if ( 'failed' !== $new_status ) {
return;
}
$order = wc_get_order( $order_id );
if ( ! $order ) {
return;
}
$ip = $order->get_customer_ip_address();
openlog( 'wordpress', LOG_PID | LOG_ODELAY, LOG_LOCAL0 );
syslog( LOG_WARNING, "woocommerce.payment_failed ip=$ip order=$order_id" );
closelog();
}, 10, 3 );
You should get something like this in your syslog:
Sep 18 14:25 host wordpress[12345]: woocommerce.payment_failed ip=1.2.3.4 order=1234
Hope this helps!
Related Posts:
- Get specific values in Woocommerce Rest API
- Javascript error when adding an item to the cart [closed]
- how to create additional button on single product page
- Woocommerce check if email already created order recently [closed]
- Switch to user link
- Is it possible to checkout with 2 different shipping options on a single order? [closed]
- Sender e-mail address, for new order email to customer, is suddenly wrong [closed]
- Pass class to Woocommerce shortcode [relative_products] [closed]
- Woocommerce product editor does not add br
- Can’t find a product by SKU
- Weird strange letters appeared in all website links [duplicate]
- A Woo commerce extension has deleted my old theme.How to undo? [closed]
- How can I remove a WooCommerce Product Tab’s sub section in wp-admin?
- is_shop doesn’t work for woocommerce [closed]
- How can I edit the Woocommerce product widget html class?
- Strip string from $_product->get_title() to get a cleaner mini-cart
- Can’t show Woocommerce product category description
- Create new email in WooCommerce
- Display vendor phone number on single product page
- 3 Different Prices for Woocommerce Product
- Retrieve Data from Custom Endpoint
- Ajax add to cart not updating Elementor mini cart totals
- I want to store user password (during registration) in an other table in the same database in addition to the user table MD5 Hash
- How to edit the default woo-commerce Store page meta title tag “Products”
- Unable to add product to the cart
- How to create a WooCommerce Product filter based on PHP foreach
- Use ID as slug for product category by default in WooCommerce?
- Custom Email via Hook only for completed order
- Woocommerce : Add name filed of checkout page to buyers wordpress display name
- Change WooCommerce product and variation prices programatically without affecting performance
- Help to locate a woocommerce hook method
- woocommerce_product_quick_edit_save hook not fired
- Changing Title Tag on Shop Archive Page (current solution reverting to Title of First Product in Loop)
- WooCommerce return 404 in the product page
- How to remove Calendar on Woocommerce Category Pages
- How to remove the Sub category product URL Woocommerce
- WC_Structured_Data Class Causing Needless Translation
- What is the meta_key for woocommerce discount amount?
- How do i display zip code options during checkout [closed]
- Why does wc_get_products($arg) return no products when $arg = ‘average_rating’ => 5.0
- Query product’s image path by category WooCommerce database?
- Delete comma in front of currency woocommerce
- Not displaying Category and subcategory from woocommerce Pluign
- Collapsible product categories on sidebar?
- Woocommerce – wc_cart_totals_shipping_method_label() breaking out option tag
- Woocommerce Add prices
- How to limit Woocommerce search to titles only?
- How to invoice Woocommerce customer the remainder balance amount for additional items to an already paid order
- currentURL is not defined
- Adding a second button next to the shop button Woocommerc [closed]
- How to set subcategory in Woocommerce?
- Woocommerce – How to Show product tags in shop page
- Bulk edit orders to ‘wc-processing’ status
- Add button linked to single product page on order detail page
- Woocommerce REST API not considering discounts and coupons
- Multiple sorting criteries (order by)
- Woocommerce Order Reports MYSQL
- woocommerce price filter not working when change currency
- With what hook do I remove WooCommerce existing Product Data Tab form fields?
- After update Woocommerce shop page not showing products
- Remove link for Woocommerce product tags
- WooCommerce Class dosen’t exist
- syntax error – woocommerce
- How to on/off woocommerce filter with redux framework [closed]
- Add youtube embed to woocommerce variations
- WooCommerce – Large number of product variations (200+)
- Add custom link/pop up under variations dropdown
- Problem in woocommerce.The option “Add product image” is gone.Please help me!
- How to make product free for some customers and paid for others?
- Admin Order adding an extra product on add_line_item
- Woocommerce: Some action hooks not firing inside class [closed]
- Is it possible Different templates of products for specific category in WooCommerce?
- WooCommerce: Conditional Tag for Wishlist Page
- Display x number of terms and exclude hidden
- Hide woocommerce login form
- Allow authors to use their own PayPal account and payment process automation [closed]
- How to move WooCommerce Product Data Box below Title Box in Edit
- Custom access given to Admin dashboard
- WooCommerce, after moving reviews tab to under product description. If pagination link is clicked description is hidden
- Can a woocommerce hook alter the UI of a website?
- How to show Woocommerce add to cart form for variable product on custom location [closed]
- Adding more information to a Content Product Category
- Woocommerce | Product page seems differently on my 2 websites
- How to get products outside main loop in Woocommerce?
- WooCommerce shipping tax
- How to change “reply to” email address for specific Woocommerce products
- Woocommerce API REST search by multiple keywords
- Problems using WooCommerce & Qstomizer
- woocommerce change tax rate with checkbox
- How to handle WordPress account for terminated employee
- WooCommerce Pruduct and Category Grid costumization [closed]
- Error: DNS_PROBE_FINISHED_NXDOMAIN WordPress / Woocommerce
- Calculate order end date based on date and number of weeks ACF fields
- Football kit management system in WordPress
- To many WooCommmerce related transients in WordPress options table
- Display List of Products With Missing Attribute?
- WooCommerce Webhook Action When a New Product Review was Submitted/Created
- Searching in categories AND custom fields
- How to detect changes in WooCommerce store (react)?
- Issues with WooCommerce: jquery.blockUI.min.js