Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter axeleus

    (@axeleus)

    Are you trying to convince me of something? With antics, everything is fine with me, it was until you released an update. I know that on the previous “stable” version Woo everything works for me. And you either don’t want to check it properly or don’t want to admit that something went wrong.

    That’s all.

    Thread Starter axeleus

    (@axeleus)

    I have my own data exchange methods, different from the standard ones.

    To be honest, I was hoping to spend the day with benefit, create something new, and do your work.

    Maybe someone comes in handy. Hook disables check WooCommerce REST API

    function _for_own_rest( $result ) {
    
        $rest_prefix = trailingslashit( rest_get_url_prefix() );
        if ( false !== strpos( $_SERVER['REQUEST_URI'], $rest_prefix . 'own/v1/' ) ){
            add_filter('woocommerce_rest_is_request_to_rest_api', function ( $param ) {
                return false;
            }, 100, 1);
        }
        return $result;
    }
    add_action( 'determine_current_user', '_for_own_rest', 10, 1 );
    Thread Starter axeleus

    (@axeleus)

    When I call https://example.com/wp-json/myendpoint/ I got this response {"code":"woocommerce_rest_authentication_error","message":"Consumer key is invalid.","data":{"status":401}}

    Thread Starter axeleus

    (@axeleus)

    it works only for the WooCommerce plugin, and cuts other third-party requests. You compare with the previous version of your plugin.

    At the moment, when I send a request to my REST API, I get this {“code”:”woocommerce_rest_authentication_error”,”message”:”Consumer key is invalid.”,”data”:{“status”:401}}

    that is old handler:

    protected function is_request_to_rest_api() {
    	if ( empty( $_SERVER['REQUEST_URI'] ) ) {
    		return false;
    	}
    
    	$rest_prefix = trailingslashit( rest_get_url_prefix() );
    
    	// Check if our endpoint.
    	$woocommerce = ( false !== strpos( $_SERVER['REQUEST_URI'], $rest_prefix . 'wc/' ) ); // @codingStandardsIgnoreLine
    
    	// Allow third party plugins use our authentication methods.
    	$third_party = ( false !== strpos( $_SERVER['REQUEST_URI'], $rest_prefix . 'wc-' ) ); // @codingStandardsIgnoreLine
    
    	return apply_filters( 'woocommerce_rest_is_request_to_rest_api', $woocommerce || $third_party );
    }

    that is new version:

    public function is_rest_api_request() {
    	if ( empty( $_SERVER['REQUEST_URI'] ) ) {
    		return false;
    	}
    
    	$rest_prefix         = trailingslashit( rest_get_url_prefix() );
    	$is_rest_api_request = ( false !== strpos( $_SERVER['REQUEST_URI'], $rest_prefix ) ); // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
    
    	return apply_filters( 'woocommerce_is_rest_api_request', $is_rest_api_request );
    }

    In other words, you check for $rest_prefix which is equal to wp-json and all requests from third-party plug-ins go to ashes. Maybe I don’t understand something, but do you really think you can afford it?

    This is very strange, I could not get the same result as yours. I can recommend you to turn off other plugins and check the editing of the products.
    Products that you remove from your store can be re-imported from “Check my imports list”.

    You had an error in the “Dirección del sitio (URL)” field (“Ajustes generales”), instead of https:// it was specified https://. As soon as they changed, everything worked, check it!

    Most likely a problem with the server. Perhaps it is worth banning the exchange of data between servers via cURL. In any case, write to tech support and your problems will solve: https://dropship.me/contact-us/

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