Title: REST API problem
Last modified: May 15, 2023

---

# REST API problem

 *  Resolved [sacredsamf](https://wordpress.org/support/users/sacredsamf/)
 * (@sacredsamf)
 * [3 years ago](https://wordpress.org/support/topic/rest-api-problem-9/)
 *     ```wp-block-code
       Hello
       The problem is that plugin (popupbuilder-woocommerce) adds/echos script tag on woocommerce_add_to_cart action and when it is done via REST Api it breaks the response.
   
       File: popupbuilder-woocommerce\com\classes\Filters.php
       Function:
       add_action('woocommerce_add_to_cart', array($this, 'addToCartNotAjax'));
   
       public function addToCartNotAjax()
       {
       $cartArgs = array(
       'total-price' => GetProductsHelper::getTotalPrice(),
       'number-of-product' => GetProductsHelper::getNumberOfProducts(),
       'products-ids' => GetProductsHelper::getProductsIds()
       );
       $cartArgs = json_encode($cartArgs);
       $redirectAfterAddToCart = get_option('woocommerce_cart_redirect_after_add');
       if (!defined('DOING_AJAX') && $redirectAfterAddToCart == 'no') {
       echo "SCRIPT HERE";
       }
       }
   
       screenshot
       https://freeimage.host/i/HUwc10N
       ```
   
 * ![](https://freeimage.host/i/HUwc10N)
 * Is it possible to add REST Api check or add a filter so that echoing can be disabled
   on demand?
   Thanks

Viewing 1 replies (of 1 total)

 *  [vi-support](https://wordpress.org/support/users/vicrisostomo/)
 * (@vicrisostomo)
 * [3 years ago](https://wordpress.org/support/topic/rest-api-problem-9/#post-16747251)
 * Hello there,
 * We are sorry to hear that you are facing issues.
   Please kindly note that according
   to the WP [Guidelines ](https://wordpress.org/support/guidelines/#do-not-post-about-commercial-products)
   questions regarding the Pro Plugin cannot be discussed publicly.Please contact
   us directly.Here’s the link [https://help.popup-builder.com/en/](https://help.popup-builder.com/en/),
   you will see an option to chat with us or send us an email.

Viewing 1 replies (of 1 total)

The topic ‘REST API problem’ is closed to new replies.

 * ![](https://ps.w.org/popup-builder/assets/icon-128x128.gif?rev=2698840)
 * [Popup Builder - Create highly converting, mobile friendly marketing popups.](https://wordpress.org/plugins/popup-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/popup-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/popup-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/popup-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/popup-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/popup-builder/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [vi-support](https://wordpress.org/support/users/vicrisostomo/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/rest-api-problem-9/#post-16747251)
 * Status: resolved