Advertisement
Fany_VanDaal

Náhled Thank you

Oct 11th, 2023
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. // zobrazení děkovné stránky z detailu objednávky
  2. add_filter( 'woocommerce_order_actions', 'vandaal_show_thank_you_page_order_admin_actions', 9999, 2 );
  3.  
  4. function vandaal_show_thank_you_page_order_admin_actions( $actions, $order ) {
  5.    if ( $order->has_status( wc_get_is_paid_statuses() ) ) {
  6.       $actions['view_thankyou'] = 'Zobrazit děkovnou stránku';
  7.    }
  8.    return $actions;
  9. }
  10.  
  11. add_action( 'woocommerce_order_action_view_thankyou', 'vandaal_redirect_thank_you_page_order_admin_actions' );
  12.  
  13. function vandaal_redirect_thank_you_page_order_admin_actions( $order ) {
  14.    $url = add_query_arg( 'adm', $order->get_customer_id(), $order->get_checkout_order_received_url() );
  15.    add_filter( 'redirect_post_location', function() use ( $url ) {
  16.       return $url;
  17.    });
  18. }
  19.  
  20. add_filter( 'determine_current_user', 'vandaal_admin_becomes_user_if_viewing_thank_you_page' );
  21.  
  22. function vandaal_admin_becomes_user_if_viewing_thank_you_page( $user_id ) {
  23.    if ( ! empty( $_GET['adm'] ) ) {
  24.       $user_id = wc_clean( wp_unslash( $_GET['adm'] ) );
  25.    }
  26.    return $user_id;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement