@@ -295,7 +295,6 @@ public function nginx_helper_default_settings() {
295295'is_cache_preloaded ' => 0 ,
296296'roles_with_purge_cap ' => array (),
297297'purge_woo_products ' => 0 ,
298- 'purge_woo_rest ' => 0 ,
299298);
300299
301300}
@@ -982,19 +981,12 @@ public function nginx_helper_update_role_caps() {
982981 * @since 2.3.5
983982 */
984983public function init_woocommerce_hooks () {
985- if ( ! is_plugin_active ( 'woocommerce/woocommerce.php ' ) ) {
984+ if ( ! is_plugin_active ( 'woocommerce/woocommerce.php ' ) || empty ( $ this -> options [ ' purge_woo_products ' ] ) ) {
986985return ;
987986}
988987
989- // Purge on purchase (stock reduction).
990- if ( ! empty ( $ this ->options ['purge_woo_products ' ] ) ) {
991- add_action ( 'woocommerce_reduce_order_stock ' , array ( $ this , 'purge_product_cache_on_purchase ' ), 10 , 1 );
992- }
993-
994- // Purge on product update (Admin, REST, programmatic).
995- if ( ! empty ( $ this ->options ['purge_woo_rest ' ] ) ) {
996- add_action ( 'woocommerce_update_product ' , array ( $ this , 'purge_product_cache_on_update ' ), 10 , 1 );
997- }
988+ add_action ( 'woocommerce_reduce_order_stock ' , array ( $ this , 'purge_product_cache_on_purchase ' ), 10 , 1 );
989+ add_action ( 'woocommerce_update_product ' , array ( $ this , 'purge_product_cache_on_update ' ), 10 , 1 );
998990}
999991
1000992
0 commit comments