Skip to content

Commit

Permalink
Merge pull request #719 from bootscore/Rename-the-ajax-cart-files
Browse files Browse the repository at this point in the history
Rename the ajax cart files and some functions
  • Loading branch information
crftwrk committed Mar 5, 2024
2 parents c42cbb0 + 6cebd2b commit 3884685
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
3 changes: 2 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

Contributors: Bastian Kreiter, Justin Kruit, Martin Holzer, Tim Groeneveld, Laurent Binder, Patrick, Gustavo Silva, TershiXia,
electronicsandprogramming, charly, Alexandros Kourmoulakis, Sven Geiß, ucalegonte, Benhaim Ido, Sean Emerson, Androidacy, Tamás Dohány,
David Vanderhaeghe, Karsten Reincke, Patrick Champoux, sweetappleuk, exlexv, Beda Schmid, JWestarp, sir-lexonarkz, xoneill007
David Vanderhaeghe, Karsten Reincke, Patrick Champoux, sweetappleuk, exlexv, Beda Schmid, JWestarp, sir-lexonarkz, xoneill007,
Anisur Rahman

Tags: featured-images, threaded-comments, translation-ready

Expand Down
File renamed without changes.
15 changes: 7 additions & 8 deletions woocommerce/inc/wc-mini-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
/**
* Mini cart Header
*/
if (!function_exists('bs_mini_cart')) :
function bs_mini_cart($fragments) {
if (!function_exists('bootscore_mini_cart')) :
function bootscore_mini_cart($fragments) {

ob_start();
$count = WC()->cart->cart_contents_count; ?>
Expand All @@ -32,7 +32,7 @@ function bs_mini_cart($fragments) {
return $fragments;
}

add_filter('woocommerce_add_to_cart_fragments', 'bs_mini_cart');
add_filter('woocommerce_add_to_cart_fragments', 'bootscore_mini_cart');

endif;

Expand All @@ -42,14 +42,13 @@ function bs_mini_cart($fragments) {
*/
remove_action('woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_button_view_cart', 10);
remove_action('woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_proceed_to_checkout', 20);
add_action('woocommerce_widget_shopping_cart_buttons', 'my_woocommerce_widget_shopping_cart_button_view_cart', 10);
add_action('woocommerce_widget_shopping_cart_buttons', 'my_woocommerce_widget_shopping_cart_proceed_to_checkout', 20);
add_action('woocommerce_widget_shopping_cart_buttons', 'bootscore_widget_shopping_cart_button_view_cart', 10);
add_action('woocommerce_widget_shopping_cart_buttons', 'bootscore_widget_shopping_cart_proceed_to_checkout', 20);

function my_woocommerce_widget_shopping_cart_button_view_cart() {
function bootscore_widget_shopping_cart_button_view_cart() {
echo '<a href="' . esc_url(wc_get_cart_url()) . '" class="btn btn-outline-primary d-block mb-2">' . esc_html__('View cart', 'woocommerce') . '</a>';
}

function my_woocommerce_widget_shopping_cart_proceed_to_checkout() {
function bootscore_widget_shopping_cart_proceed_to_checkout() {
echo '<a href="' . esc_url(wc_get_checkout_url()) . '" class="btn btn-primary d-block">' . esc_html__('Checkout', 'woocommerce') . '</a>';
}

10 changes: 5 additions & 5 deletions woocommerce/wc-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
* Register Ajax Cart
*
* 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');
* Disable file via filter add_filter('bootscore/load_ajax_cart', '__return_false');
*/
function register_ajax_cart() {
if (apply_filters('bootscore/load_ajax', true)) {
function bootscore_register_ajax_cart() {
if (apply_filters('bootscore/load_ajax_cart', 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');
require_once('inc/ajax-cart.php');
}
}
}
add_action('after_setup_theme', 'register_ajax_cart');
add_action('after_setup_theme', 'bootscore_register_ajax_cart');

0 comments on commit 3884685

Please sign in to comment.