Forum Replies Created

Viewing 9 replies - 301 through 309 (of 309 total)
  • Hi;

    Test this snippet, I don’t test but should be work

    
    add_filter( 'woocommerce_registration_errors', 'ywp_get_password_on_registration', 999, 3 );
    function ywp_get_password_on_registration( $reg_errors, $sanitized_user_login, $user_email ) {
    
    	if ( empty ( $reg_errors ) )
    	        $_SESSION['current-upass'] = $_POST['password'];
    
    	return $reg_errors;
    }

    Hi
    you’re right; I’m sorry, I tested in registration form.

    You can use this snippet:

    
    // ----- validate password match on the registration page
    add_filter( 'woocommerce_registration_errors', 'registration_errors_validation', 10, 3 );
    function registration_errors_validation( $reg_errors, $sanitized_user_login, $user_email ) {
    	if ( is_checkout() )
    		return $reg_errors;
    
    	global $woocommerce;
    
    	extract( $_POST );
    
    	if (  $password!= $ywp_password2  )
    		return new WP_Error( 'registration-error', __( 'Passwords not match.', 'woocommerce' ) );
    
    	return $reg_errors;
    }
    
    // ----- add a confirm password fields match on the registration page
    add_action( 'woocommerce_register_form', 'wc_register_form_password_repeat' );
    function wc_register_form_password_repeat() {
    	?>
    	<p class="form-row form-row-wide">
    		<label for="reg_ywp_password2"><?php _e( 'Password Repeat', 'woocommerce' ); ?> <span class="required">*</span></label>
    		<input type="password" class="input-text" name="ywp_password2" id="ywp_password2" value="<?php if ( ! empty( $_POST['ywp_password2'] ) ) echo $_POST['ywp_password2'] ; ?>" />
    	</p>
    	<?php
    }
    
    // ----- Validate confirm password field match to the checkout page
    add_action( 'woocommerce_after_checkout_validation', 'lit_woocommerce_confirm_password_validation', 10 );
    function lit_woocommerce_confirm_password_validation( $posted ) {
    
        $checkout = WC()->checkout;
    
        if ( ! is_user_logged_in() && $checkout->must_create_account )
            if ( $posted['account_password']!=$posted['ywp_password2'] )
    			wc_add_notice( 'error', 'error' ); 
    }
    
    // ----- Add a confirm password field to the checkout page
    add_action( 'woocommerce_checkout_init', 'lit_woocommerce_confirm_password_checkout', 10, 1 );
    function lit_woocommerce_confirm_password_checkout( $checkout ) {
        if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) {
    
            $fields = $checkout->get_checkout_fields();
    
            $fields['account']['ywp_password2'] = array(
                'type'              => 'password',
                'label'             => __( 'Confirm password', 'woocommerce' ),
                'required'          => true,
                'placeholder'       => _x( 'Confirm Password', 'placeholder', 'woocommerce' )
            );
    
            $checkout->__set( 'checkout_fields', $fields );
        }
    }

    Hi

    Absolutely yes; Woocommerce do all of these tasks perfectly by default

    But you need these:
    1- A woocommerce friendly theme
    2- configure Woocommerce based its documentation
    https://docs.woocommerce.com/

    Hi
    Yes, Woocommerce can handle your work,

    You can add product license as order meta on checkout proccess or in admin area:

    https://www.cloudways.com/blog/how-to-edit-delete-fields-and-email-in-woocommerce-custom-checkout-fields/

    and you can use scheduled tasks and woocommerce email management system for send emails:

    https://developer.www.ads-software.com/reference/functions/wp_schedule_event/
    https://developer.www.ads-software.com/plugins/cron/scheduling-wp-cron-events/

    Hi

    Adter theme change, widget maybe move to other widget areas

    Please goto Appeareance > Widget and check your widget in correct place

    Good luck

    Hi

    you used default field name for confirm password called password2

    Change it to ywp_password2 at all of your code that used for confirmation;

    Tested and work;

    Good luck

    Hi
    please try in another browsers

    Woocommerce uses cookies for user session validation and maybe your browser has some errors with cookies

    Good luck

    Hi

    You should put this css code in your style file in child theme:

    @media only screen and (max-width: 510px){
       body div .first {
          margin-left: auto !important;
       }
    }
    .bbp-pagination .bbp-pagination-links, .fusion-pagination, .page-links, .pagination, .woocommerce-pagination{justify-content: center!important}
    

    If don’t work use this snippet:

    add_action( 'wp_head', 'my_product_list_margin' ); // or add_action( 'wp_footer', 'my_product_list_margin' ); 
    function my_product_list_margin() {
        ?>
        <style>
            @media only screen and (max-width: 510px){
               body div .first {
                  margin-left: auto !important;
               }
            }
    
            .bbp-pagination .bbp-pagination-links, .fusion-pagination, .page-links, .pagination, .woocommerce-pagination{justify-content: center!important}
        </style>
        <?php
    }

    Hi
    You can use this line of code:

    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

    This code removes add to cart button, quantity, variation select area.
    If you need remove just add to cart button, use this snippet:

    add_action( 'woocommerce_single_product_summary', 'ywp_replace_add_to_cart_btn', 31 );
    function ywp_replace_add_to_cart_btn() {
    ?>
        <style>div.quantity,.single_add_to_cart_button{display:none}</style>
        // Remove add to cart button and quantity input box, restrict user use inspect element in him/her browser
        <script>jQuery(document).ready(function($){$('div.quantity,.single_add_to_cart_button'),remove()})</script>
    <?php
        // Add your custom button
        echo '<a href="#" class="single_add_to_cart_button button alt">Custom button</a>';
    }
    

    Good luck

Viewing 9 replies - 301 through 309 (of 309 total)