Support » Plugin: WooCommerce Add to Cart Custom Redirect » Can’t Delete Redirect on Add to Cart (+ Solution)

  • taewoo

    (@taewoo)


    I can’t delete Redirect on Add to Cart by removing it.

    That’s b/c your code is looking for non-empty values only

    
            if ( ! empty( $rv_woo_redirect_url ) ) {
                    update_post_meta( $post_id, '_rv_woo_product_custom_redirect_url', esc_url( $rv_woo_redirect_url ) );
    

    should be

    
    
            if ( ! empty( $rv_woo_redirect_url ) ) {
                    update_post_meta( $post_id, '_rv_woo_product_custom_redirect_url', esc_url( $rv_woo_redirect_url ) );
            } else {
                   delete_post_meta( $post_id, '_rv_woo_product_custom_redirect_url');
            }
    
    

    in function rv_woo_add_custom_general_fields_save() in woocommerce-custom-redirect.php

  • The topic ‘Can’t Delete Redirect on Add to Cart (+ Solution)’ is closed to new replies.