Home Forums Themes Support Claue Recommendations and New Ideas

Topic Resolution: Not a Question

This topic contains 34 replies, has 5 voices, and was last updated by  Harry 1 month, 1 week ago.

Viewing 5 posts - 31 through 35 (of 35 total)
  • Author
    Posts
  • #25565

    Hello guys,

    Hope all of you are fine.

    For those who want to hide the coupon code section on the cart page or checkout page this is a usable function to add to your functions.php of your active theme.

    Some of you may like to force the customer to apply the coupon just on the cart page, or some others of you like me would like to have only one section for the coupon code at the end on the checkout page.

    So for any need just add these to your functions.php.

    Hiding coupon code on the cart page:

    // hide coupon field on cart page
    
    function hide_coupon_field_on_cart( $enabled ) {
    
    if ( is_cart() ) {
    
    $enabled = false;
    
    }
    
    return $enabled;
    
    }
    
    add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_cart' );

    And Hiding the coupon code on the checkout page (Not Recommended):

    // hide coupon field on checkout page
    
    function hide_coupon_field_on_checkout( $enabled ) {
    
    if ( is_checkout() ) {
    
    $enabled = false;
    
    }
    
    return $enabled;
    
    }
    
    add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_checkout' );

    Regards.

    Rahim

    Rahim Vaziri
    CEO & Founder at Look.ir

    #25905

    Hello Guys,

    I found this function very helpful.

    By adding this to your functions.php of your child-theme (if child-theme is active) you can make the customer to double check his password on two places of account creation. on the my-account page & checkout page.

    Hope you enjoy. 🙂

    The code is this:

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

    For sure you can use your own translation on the code.

    Thanks to Harry and the JanStudio team for great support.

    Regards.

    Rahim Vaziri
    CEO & Founder at Look.ir

    #25910

    Thank you so much Rahim for your kind words and share your experience.

    Have a great day!

    Harry
    Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    #26322

    Hi Harry,

    Apologies if this has already been suggested. Is it possible to display shop name or seller first and last name on category pages so it’s easy to see which shop or person the product is sold by without clicking into the product page?

    I previously used BuddyBoss Social Marketplace which had this feature. I’ve attached a screenshot of the feature. Would love if you could add this too. BuddyBoss support was rubbish and their theme slowed my site down, so I much prefer you and your theme 🙂

    For my site it would be more useful to have first and last name, rather than shop name if possible.

    Many thanks for your help,

    Karen

    Attachments:
    You must be logged in to view attached files.
    #26366

    Hi Karen,

    Could you check this option with plugin multi vendors author. This feature should implement in plugin not on theme because not all shop use for multi vendors.

    Regards

    Harry
    Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

Viewing 5 posts - 31 through 35 (of 35 total)

You must be logged in to reply to this topic.