Home Forums WoodMart support forum Issue with the API request after the latest update of the theme

Issue with the API request after the latest update of the theme

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #393648

    RichardD
    Participant

    After updating the woodmart theme, we are facing some issues in API. Below HTML is getting printed before JSON response and breaking API functionality of our mobile app

    <link rel=”stylesheet” id=”wd-int-el-animations-css” href=”https://pkkicks.org/wp-content/themes/woodmart/css/parts/int-wbp-el-animations.min.css?ver=6.5.2&#8243; type=”text/css” media=”all” />

    this is a sample route to get product details in our mobile app
    https://pkkicks.org/?api_key=LFwfaYFId9DVcCxcup1CFEA8024owQAJ&rest_route=%2Fappmaker-wc%2Fv1%2Fproducts%2F3053
    and you can see the html at the beginning of this response

    we have seen a similar situation in your support forum but couldn’t find the solution over there. Is this already resolved?
    https://xtemos.com/forums/topic/api-unexpected-character-encountered-while-parsing-value/

    #393683

    Artem Temos
    Keymaster

    Hello,

    Could you please disable all plugins that are not related to our theme and provide us your admin and FTP access so we can check it?

    Thank you in advance

    #393778

    RichardD
    Participant

    Hello,
    we cannot disable appmaker plugin since that rest route is required to check the issue
    We havedisabled all other plugins. FTP and admin provided in private content

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #393829

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to fix this

    if ( ! function_exists( 'woodmart_change_is_rest_api' ) ) {
       /**
        * This feature will add rest api validation to support rest_route.
        *
        * @return bool
        */
       function woodmart_change_is_rest_api() {
          return ( false !== strpos( $_SERVER['REQUEST_URI'], 'rest_route' ) );
       }
    
       add_filter( 'woocommerce_is_rest_api_request', 'woodmart_change_is_rest_api' );
    }

    Kind Regards

Viewing 4 posts - 1 through 4 (of 4 total)