Skip to main content

Posts

Showing posts from May, 2021

How to redirect after checkout in woo-commerce in Wordpress.

Redirect after checkout in woo-commerce in Wordpress.   Paste in function.php /* Redirect loggedin user to order details page */ if(is_user_logged_in()) { add_action( 'template_redirect', 'woocommerce_redirect_after_checkout' ); } function woocommerce_redirect_after_checkout() { global $wp; if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { $redirect_url = home_url().'/my-account/view-order/'.$wp->query_vars['order-received'] ; wp_redirect($redirect_url ); exit; } }

How to create custom guest popup for checkout with wordpress menu in wordpress.

Create custom guest popup for checkout with wordpress menu in wordpress. Paste in function.php function override_checkout_email_field( $fields ) { global $wpdb;   $popup_id = $_COOKIE['popup_id']; global $wpdb; $tablename = $wpdb->prefix . "guest_users"; $result = $wpdb->get_results ("SELECT * FROM $tablename WHERE id=$popup_id"); foreach ( $result as $print )   { } $survey_email = $print->email; $survey_phone = $print->phone;     global $woocommerce;     //$survey_email = $woocommerce->session->get('survey_email');     if(!is_null($survey_email)) {       $fields['billing']['billing_email']['default'] = $survey_email;     }      if(!is_null($survey_phone)) {       $fields['billing']['billing_phone']['default'] = $survey_phone;     }      return $fields; } add_filter( 'woocommerce_checkout_fields' , 'override_checkout_email_field' ); // Show

PHP file upload - Dynamically Add Remove input fields using JQuery and PHP.

PHP file upload - Dynamically Add Remove input fields using JQuery and PHP. Paste in View <style> .file {   visibility: hidden;   position: absolute; } .btn.btn-primary {   background-color: #007bff;   border-color: #007bff;   outline: none;   color: #fff; } .multi-cus-filed{   position:relative; } .remove-cus-filed { background: #007bff; border-radius: 200%; padding: 4px 13px; border: none; color: white; font-size: 19px; position: absolute; top: 32px; right: -40px; } .multi-cus-filed{   position:relative; } .remove-cus-filed { background: #007bff; border-radius: 200%; padding: 4px 13px; border: none; color: white; font-size: 19px; position: absolute; top: 32px; right: -40px; } </style>          <form role="form" action="" method="POST" enctype="multipart/form-data"> <div class="multi-field-wrapper">   <div class="multi-fields"