swte

Disable Swift on add to cart

Jan 27th, 2021 (edited)
125
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /**
  4.  * Plugin Name: Swift Performance Tweaks
  5.  */
  6.  
  7. if (isset($_POST['add-to-cart']) && !empty($_POST['add-to-cart'])){
  8.     add_filter('option_active_plugins', function($active_plugins){
  9.         if (($key = array_search('swift-performance/performance.php', $active_plugins)) !== false) {
  10.             unset($active_plugins[$key]);
  11.         }
  12.     });
  13. }
  14.  
  15. ?>
RAW Paste Data