Skip to content

Commit

Permalink
Merge pull request #713 from bootscore/Enable/disable-ajax-cart.php-b…
Browse files Browse the repository at this point in the history
…y-Woo-settings

Enable/disable ajax cart based on Woo settings and added a filter to …
  • Loading branch information
crftwrk committed Mar 2, 2024
2 parents 8cbb310 + a9bdc23 commit f9fa2fb
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions woocommerce/wc-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@

/**
* Register Ajax Cart
* Allow users to edit/disable entire AJAX functionality in child theme
*
* Enabled/Disabled based on the setting in backend under WooCommerce > Settings > Products > Enable AJAX add to cart buttons on archives.
* Disable file via filter add_filter('bootscore/load_ajax', '__return_false');
*/
if (!function_exists('register_ajax_cart')) :

function register_ajax_cart() {
require_once('inc/ajax-add-to-cart.php');
function register_ajax_cart() {
if (apply_filters('bootscore/load_ajax', true)) {
$ajax_cart_en = 'yes' === get_option('woocommerce_enable_ajax_add_to_cart');
if ($ajax_cart_en) {
require_once('inc/ajax-add-to-cart.php');
}
}

add_action('after_setup_theme', 'register_ajax_cart');

endif;
}
add_action('after_setup_theme', 'register_ajax_cart');

0 comments on commit f9fa2fb

Please sign in to comment.