• Resolved dorjitshering

    (@dorjitshering)


    Hi,

    First of all, thank you for creating such a feature rich and one of a kind plugin. It has been just a few hours since I installed it and I am loving it. Currently I am testing the features and all and I have realized that if I enable attachments for the messages, the field is being marked as required. I think it will be convenient for both the parties, company & customer if it is made optional since every time we message, there may not be attachments to send along accept in cases where customer sends refund request with an image of a defective item or a company sends an image of a refund statement. But most often, there will be normal conversations especially in order messages without actually having to send attachments at all. So my request is to have the attachment field made optional.

    Thanks and regards!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author WP Swings

    (@wpswings)

    Hi,
    Thanks for reaching out!

    Glad to hear your kind appreciation regarding the plugin, we have checked your query and will like to update you that currently this is not possible to make this optional in the plugin, but we have took your important suggestion and we will surely try that to implement them after a successful internal discussion and agreement between the team.

    Regards,

    Thread Starter dorjitshering

    (@dorjitshering)

    Great to hear and have a nice weekend!

    Plugin Author WP Swings

    (@wpswings)

    Hi,

    You are welcome, if further any concerns then kindly let us know.

    Regards

    Hi,
    Yes please make attach file requirement optional, because order messaging does not absolutely need an attachment
    Regards

    Finally I dequeue the script and override it to remove requirement, easy..

    Plugin Author WP Swings

    (@wpswings)

    Hi,

    Glad to hear that, if further, you need any assistance then kindly let us know.

    Regards

    simoneideagency

    (@simoneideagency)

    Hi @seds94,

    I’d like to know which section of the plugin you edited so i can make the field non mandatory also on another website.

    Thank you for your time.

    seds94

    (@seds94)

    Hi @simoneideagency

    You should update to Version 4.0.8, they remove this requirement.

    But if you don’t:
    – find js to override by searching woo-refund-and-exchange-lite-common in inspector, it should be /woo-refund-and-exchange-lite/common/js/woo-refund-and-exchange-lite-common.min.js
    – copy code, unminify it and paste in a js file, inside a template child (or a custom plugin)
    – in you new js, near l.121 just comment :
    else o = '<p class="wps_order_msg_sent_notice">' + wrael_common_param.no_file_attached + '</p><a href="" class="wps_remove_notice_msg">X</a>';

    then replace plugin js by your new js. Personnally, I custom messaging order page with a template, and it’s easier to find and override js

    What I done from Version 4.0.5:

    
    if ( is_plugin_active( 'woo-refund-and-exchange-lite/woocommerce-refund-and-exchange-lite.php') ) {
            // dequeue js plugin (and its extra):
            add_action( 'wp_enqueue_scripts', 'rma_common_remove_js', 100);
            function rma_common_remove_js() {
                if ( is_page_template('template-rma.php') ) {
                    wp_dequeue_script( 'Return Refund and Exchange for WooCommercecommon' );
                }
            }
            // enqueue your new script and its extra:
            add_action( 'wp_enqueue_scripts', 'rma_common_override_js' );
            function rma_common_override_js() {
                if ( is_page_template('template-rma.php') ) {
                    wp_enqueue_script('child-rma-common', CHILD_TMPL . '/assets/js/your-new-file-name.js', array('jquery'), '', true);
    
                    $pro_active = wps_rma_pro_active();
                    if ( get_current_user_id() > 0 ) {
                            $myaccount_page     = get_option( 'woocommerce_myaccount_page_id' );
                            $myaccount_page_url = get_permalink( $myaccount_page );
                    } else {
                            $myaccount_page     = get_option( 'woocommerce_myaccount_page_id' );
                            $myaccount_page_url = get_permalink( $myaccount_page );
                    }
                    wp_localize_script(
                            'child-rma-common',
                            'wrael_common_param',
                            array(
                                'ajaxurl' => admin_url('admin-ajax.php'),
                                'wps_rma_nonce' => wp_create_nonce('wps_rma_ajax_security'),
                                'return_subject_msg' => esc_html__('Please Enter Refund Subject.', 'woo-refund-and-exchange-lite'),
                                'return_reason_msg' => esc_html__('Please Enter Refund Reason.', 'woo-refund-and-exchange-lite'),
                                'return_select_product' => esc_html__('Please Select Product to refund.', 'woo-refund-and-exchange-lite'),
                                'check_pro_active' => esc_html($pro_active),
                                'message_sent' => esc_html__('The message has been sent successfully', 'woo-refund-and-exchange-lite'),
                                'message_empty' => esc_html__('Please Enter a Message.', 'woo-refund-and-exchange-lite'),
                                'myaccount_url' => esc_attr($myaccount_page_url),
                                'refund_form_attachment' => get_option('wps_rma_refund_attachment'),
                                'order_msg_attachment' => get_option('wps_rma_general_enable_om_attachment'),
                                'no_file_attached' => esc_html__('No File Attached', 'woo-refund-and-exchange-lite'),
                                'file_not_supported' => esc_html__('Attached File type is not supported', 'woo-refund-and-exchange-lite'),
                            )
                    );
                }
            }
    }

    Depending on your version, you have to pay attention to the handle name (ID of the script) to dequeue. You should find it when you found plugin js in inspector.

    When I updated plugin to Version 4.0.8, they seems to consider my recommendations, and ID of the script is not “Return Refund and Exchange for WooCommercecommon” anymore but “return-refund-and-exchange-for-woocommercecommon-js”, so you must dequeue it this way: wp_dequeue_script( 'return-refund-and-exchange-for-woocommercecommon' );
    In this version 4.0.8, they removed the line previously commented in your js overriden. So you don’t have to override it.

    I don’t know when they finally decided to change handle name (ID script) and remove requirement. You should be care.

    And last advice:
    To avoid problems with the html code, you should correct woo-refund-and-exchange-lite\public\partials\wps-rma-view-order-msg.php l.55:

    
    				<div class="wps-order-msg-btn">
    					</div>
    						<input type="submit" id="wps_order_msg_submit" name="wps_order_msg_submit" value="<?php esc_html_e( 'Send', 'woo-refund-and-exchange-lite' ); ?>" data-id="<?php echo esc_attr( $order_id ); ?>">
    						<input 	type="hidden" name="wps_order_msg_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wps_order_msg_nonce' ) ); ?>"> 
    					</div>
    				</div>
    

    replace with

    
    				<div class="wps-order-msg-btn">
    					<div>
    						<input type="submit" id="wps_order_msg_submit" name="wps_order_msg_submit" value="<?php esc_html_e( 'Send', 'woo-refund-and-exchange-lite' ); ?>" data-id="<?php echo esc_attr( $order_id ); ?>">
    						<input 	type="hidden" name="wps_order_msg_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wps_order_msg_nonce' ) ); ?>"> 
    					</div>
    				</div>
    

    I couldn’t do anything else but correct it inside the plugin, you’ll have to check it after each update. I also reported this carelessness, but it still hasn’t been corrected.

    • This reply was modified 2 years ago by seds94.
    • This reply was modified 2 years ago by seds94.
    • This reply was modified 2 years ago by seds94.
    • This reply was modified 2 years ago by seds94.
    simoneideagency

    (@simoneideagency)

    Hi, @seds94
    thank you so much for the pro response!

    Tmr i’ll try your method, i’ll get back to you asap.

    Thank you for your time

    simone

    Plugin Author WP Swings

    (@wpswings)

    Sure,

    If you need any further help feel free to connect with us.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Make the attachment field optional’ is closed to new replies.