Title: Infinite Loop When Adding To Cart
Last modified: September 2, 2026

---

# Infinite Loop When Adding To Cart

 *  Resolved [Slocum Studio](https://wordpress.org/support/users/slocumstudio/)
 * (@slocumstudio)
 * [2 weeks, 3 days ago](https://wordpress.org/support/topic/infinite-loop-when-adding-to-cart/)
 * Hello,
 * Thank you for creating this plugin! It has served us well, allowing us to add
   required products to the cart when corresponding items are added. The plugin 
   has been working great until recently. I’m not exactly sure which version or 
   what date this started occurring on. We have an infinite loop issue when customers
   are adding to the cart.
 * Customers on a client site are attempting to add a product to their cart but 
   the website is timing out. I determined the issue is tied to the Force Sell for
   WooCommerce plugin. I came up with a temporary work-around which I will share
   below.
 * If we deactivate Force Sell for WooCommerce the issue does not occur. We have
   a variable Membership/Subscription product. We have added conditions to force
   sell another Simple product when those variations are added to the cart. When
   the variable product is added to the cart, the site times out as I mentioned 
   earlier. While debugging, I determined that Force Sell for WooCommerce was stuck
   in an infinite loop during the WooCommerce “add_to_cart” actions. Note that we
   do have some customized logic in a plugin for our client’s particular use case.
   However, deactivating our customizations did not help.
 * As we needed to get the site functional as soon as possible, I determined that
   if I removed a set of actions and filters before Force Sell for WooCommerce called
   the WooCommerce add_to_cart() function, the issue was resolved.
 * I added the following code **before** the WC()->cart->add_to_cart() call on line
   225 in [includes/force-sell-types/add_force_sell.php](https://plugins.trac.wordpress.org/browser/force-sell-for-woocommerce/tags/3.6.4/includes/force-sell-types/add_force_sell.php#L225):
 *     ```wp-block-code
       remove_action( 'woocommerce_add_to_cart', array( $this, 'add_to_cart' ) );remove_filter('berocket_force_sell_check_result_add_to_cart', array($this, 'check_result_add_to_cart'));remove_filter('berocket_force_sell_check_result_other', array($this, 'check_result_other'));
       ```
   
 * I know this is a temporary work-around. I’m not sure if this is even the correct
   fix, but it appears to be working on our client site. I’d be happy to share a
   staging environment with you, including login details, via email if it helps.
   Let me know if you need clarification on anything.
 * Thank you!

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

 *  Thread Starter [Slocum Studio](https://wordpress.org/support/users/slocumstudio/)
 * (@slocumstudio)
 * [2 weeks, 3 days ago](https://wordpress.org/support/topic/infinite-loop-when-adding-to-cart/#post-19009862)
 * Hello,
 * I forgot to include some other details. It did not seem to matter if we changed
   the force sell condition mode to Normal or Cart. We are using Cart mode on production.
 * Also, we have 2 total variation products which we’d are applying the force sell
   corresponding product to. We have specified both of these in the condition products.
   The force sell products cannot be removed from the cart (via the General settings
   checkbox). We are adding of the force sell 2 products (Count setting) to the 
   user’s cart.
 * Thanks!
 *  Plugin Author [Dmytro Holovnia](https://wordpress.org/support/users/dholovnia/)
 * (@dholovnia)
 * [2 weeks, 1 day ago](https://wordpress.org/support/topic/infinite-loop-when-adding-to-cart/#post-19011374)
 * Hello,
 * A new version of the plugin has been released. Please check if the issue is resolved.
 * Regards,
   Dmytro
 *  Thread Starter [Slocum Studio](https://wordpress.org/support/users/slocumstudio/)
 * (@slocumstudio)
 * [1 week, 4 days ago](https://wordpress.org/support/topic/infinite-loop-when-adding-to-cart/#post-19014539)
 * Hi Dmytro,
 * Thank you for the quick response and plugin update! I tested today and it does
   look like the issue is resolved in the latest version. I will mark this thread
   as resolved.
 * Thanks again!

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

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Finfinite-loop-when-adding-to-cart%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/force-sell-for-woocommerce/assets/icon-256x256.gif?rev=2776478)
 * [Force Sell for WooCommerce](https://wordpress.org/plugins/force-sell-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/force-sell-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/force-sell-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/force-sell-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/force-sell-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/force-sell-for-woocommerce/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Slocum Studio](https://wordpress.org/support/users/slocumstudio/)
 * Last activity: [1 week, 4 days ago](https://wordpress.org/support/topic/infinite-loop-when-adding-to-cart/#post-19014539)
 * Status: resolved