• Resolved alfaherbalcareshop

    (@alfaherbalcareshop)


    we need the below requirement

    customer need to cancel and return woocommerce order

    need cancel and return button in woocommerce order page

    also cancel and return button option will disable after sometime (for examble after 6h or 1 day)

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hey,

    Do you mean customer, the customer for who you make the website? so that that button must be available in the backend or do you mean customer, a customer who purchases something in the webshop, so that the button must be available in the frontend via my account order page?

    Can you add a screenshot with some info of where you would like to see that button? because the code that must be provided for this will depend on where you want to display the button.

    Regards

    Thread Starter alfaherbalcareshop

    (@alfaherbalcareshop)

    check the image link : https://ibb.co/Y0BMyH1

    need cancel and return button will shown in my order page

    also cancel and return button option will disable after sometime (for examble after 6h or 1 day)

    Here an example for the cancel button, maybe you can build on this

    add_filter( 'woocommerce_valid_order_statuses_for_cancel', 'filter_valid_order_statuses_for_cancel', 20, 2 );
    function filter_valid_order_statuses_for_cancel( $statuses, $order = '' ){
    
        // Set HERE the order statuses where you want the cancel button to appear
        $custom_statuses    = array( 'pending', 'processing', 'on-hold', 'failed' );
    
        // Set HERE the delay (in days)
        $duration = 3; // 3 days
    
        // UPDATE: Get the order ID and the WC_Order object
        if( ! is_object( $order ) && isset($_GET['order_id']) )
            $order = wc_get_order( absint( $_GET['order_id'] ) );
    
        $delay = $duration*24*60*60; // (duration in seconds)
        $date_created_time  = strtotime($order->get_date_created()); // Creation date time stamp
        $date_modified_time = strtotime($order->get_date_modified()); // Modified date time stamp
        $now = strtotime("now"); // Now  time stamp
    
        // Using Creation date time stamp
        if ( ( $date_created_time + $delay ) >= $now ) return $custom_statuses;
        else return $statuses;
    }
    Thread Starter alfaherbalcareshop

    (@alfaherbalcareshop)

    its working for cancel but mail not received regarding cancellation

    how to add return button???

    Well, either you try to adjust the code yourself, or you look for a developer who can do this for you????

    You’re welcome!

    Plugin Support AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey again!

    For adding a return management, I would recommend using a plugin like this one: https://woocommerce.com/products/warranty-requests/

    That will add all the mechanisms needed to handle RMA for your customers, and from the admin side.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Need Cancel and Return Option for woocommerce orders’ is closed to new replies.