• Resolved jsima

    (@jsima)


    I am using wordpress rest api to fetch products. But in the rest api, html code is passing too. Snapshot :- https://i.imgur.com/awsnXSc.png

    I used the following code, so rest api would not fetch the html code. But it does not work.

    // Remove Span Tags From Woocommerce Price Start Here
    
    function modify_wc_price( $return, $price, $args ) {
    // remove span tags
    $negative          = $price < 0;
    $formatted_price = ( $negative ? '-' : '' ) . sprintf( $args['price_format'],     get_woocommerce_currency_symbol( $args['currency'] ), $price );
    return $formatted_price;
    }
      add_filter( 'wc_price', 'modify_wc_price', 99, 3 );
    
    // Remove Span Tags From Woocommerce Price End Here

    Could anyone let me know how can I solve the problem?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress’s Rest Api is fetching HTML Code’ is closed to new replies.