Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,
    I’m defining custom endpoint route using controller method, which is extending WP_REST_Controller. I’ve used this code in a custom file called api.php in my active theme.

    class Slug_Custom_Route extends WP_REST_Controller {
    
        public function register_routes() {
            register_rest_route('my-route', 'my-phrase', array(
                'methods' => 'POST',
                'callback' => 'custom_phrase',
                    )
            );
        }
    
        public function custom_phrase(WP_REST_Request $request) {
            $param = $request['param'];
        return rest_ensure_response('Hello World! This is my first REST API' . $param);
        }
    
    }
    add_action('rest_api_init', 'register_routes');

    It’s populating the result – 404 rest_no_route.

    As I’m new to all of this, Kindly help me to resolve.

    • This reply was modified 4 years, 4 months ago by pramo15.

    Hi @prabhatbigfoot

    As per your suggestion, I’ve configured the plugin with Shiprocket registered email & also added weight & dimension for woocommerce products. But still it’s showing “pincode isn’t servicable”. So any suggestion is highly appreciated!

    HI,

    I’ve updated dimensions and weight information of all products. But still all pincodes are showing as non-servicable.

Viewing 3 replies - 1 through 3 (of 3 total)