Are woocommerce_thankyou hook and is_order_received_page() redundant? [closed]

The WooCommerce Code Reference for the woocommerce_thankyou hook points to WooCommerce thankyou page code: The thankyou page checks if the order failed or was successful, using the order-received.php, as you can see below (lines 23 to 51): <div class=”woocommerce-order”> <?php if ( $order ) : do_action( ‘woocommerce_before_thankyou’, $order->get_id() ); ?> <?php if ( $order->has_status( ‘failed’ … Read more

how to execute a function only when i send an order to trash [closed]

It depend if you’re using HPOS or not: If not: function my_custom_function_on_order_trash( $post_id ) { // Get the post type of the trashed item $post_type = get_post_type( $post_id ); // Check if the trashed item is an order if ( ‘shop_order’ === $post_type ) { // Your custom code here } } add_action( ‘wp_trash_post’, ‘my_custom_function_on_order_trash’ … Read more

How to block checkout process when session origin is unknown?

add_action(‘woocommerce_checkout_create_order’, function($order, $data) { if (!isset($_REQUEST[‘wc_order_attribution_utm_source’])) { wc_add_notice(__(‘Order creation failed: Safetech Security.’, ‘woocommerce’), ‘error’); throw new Exception(‘Order creation halted.’); } }, 10, 2); This works for me Updates the issue is in the Paypal wooocommerce plugin, I had to edit the code and stop auto-update if (!isset($_COOKIE[‘sbjs_first’])) { throw new RuntimeException( __(‘Order creation failed: Origin … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)