Loading...

WooCommerce

| 94 Comments on WooCommerce

Bootscore offers comprehensive support for WooCommerce, utilizing Bootstrap and featuring an integrated AJAX offcanvas cart functionality.

By default, all WooCommerce-related scripts are deactivated to optimize performance. If WooCommerce is installed, the required scripts, such as those for the cart and account, will be automatically activated.

AJAX cart

Overview

Bootscore extends the existing WooCommerce AJAX functionality to single-product pages, allowing customers to add/remove/manage products without page reloads.

Note that the AJAX cart can add/remove products and manage their quantities but cannot handle some virtual product types that have already been purchased and paid for.


As an example, if the WooCommerce Subscription plugin has setting that customers allows to change their existing membership from Premium to Basic. Because Premium membership is already paid, AJAX cart can not downgrade their existing plan. In such cases, it’s necessary to disable the AJAX cart functionality.

AJAX scripts are enabled by WooCommerce’s default settings in Backend > WooCommerce > Settings > Products tab:

  • “Redirect to the cart page after successful addition” must be disabled.
  • “Enable AJAX add to cart buttons on archives” must be enabled.

After the product has been successfully added or if the addition fails, the integrated Offcanvas shopping cart opens and displays an alert indicating whether the product has been added or not. Try it yourself:

The AJAX function works seamlessly with all product types:

  • Simple products
  • Variable products
  • Grouped products
  • Affiliate products
  • Product out of stock
  • Only one product in stock left
  • Product sold individually
  • Add to cart buttons in other page content

Skipped cart page

Because the offcanvas cart is a full-fledged cart, except for the ability to add coupons and calculate shipping (both of which are available at checkout as well), the cart page is skipped for a better shopping experience because there is no need to have a cart twice.

  • Offcanvas cart displays only a “Proceed to checkout” button
  • Cart page redirects to checkout
  • “Back-to-cart” button in checkout links to shop page

Enable cart page

The cart page can be easily enabled by a filter in the child’s functions.php file.

/**
 * Enable cart page
 */
add_filter('bootscore/skip_cart', '__return_false');
  • Offcanvas cart shows a “View cart” button above the “Proceed to checkout” button
  • Redirect cart page to checkout is disabled
  • “Back-to-cart” button in checkout links to cart page

Disable AJAX cart

AJAX functionality can be disabled in WooCommerce settings in Backend > WooCommerce > Settings > Products tab by disabling “Enable AJAX add to cart buttons on archives”.

  • “Redirect to the cart page after successful addition” can be enabled.

Restoring WooCommerce’s default functionality

While AJAX cart scripts are enabled or disabled depends on WooCommerce settings, it’s also possible to deactivate Bootscore’s AJAX scripts without altering any WooCommerce settings.

Two filters are needed to disable all Bootscore’s cart scripts: one to enable the cart page and one to disable the AJAX cart in the child theme’s functions.php file.

/**
 * Enable cart page
 */
add_filter('bootscore/skip_cart', '__return_false');

/**
 * Disable AJAX cart
 */ 
add_filter('bootscore/load_ajax_cart', '__return_false');

Now, all additional AJAX scripts provided by Bootscore are disabled and default WooCommerce AJAX functionality is restored.

AJAX Login

Bootscore extends the default WooCommerce login form into an AJAX-powered form, allowing customers to log in without reloading the page.

The AJAX script is bound to the default WooCommerce login form and may cause issues if a third-party plugin, for example Sensei (WP Paid Courses), adds an additional login form. In such cases, the AJAX login should be disabled.

Disable AJAX Login

Disable AJAX login with a filter in child-theme’s functions.php:

/*
 * Disable AJAX login
 */
add_filter('bootscore/wc_ajax_login', '__return_false');

Cart and checkout since WC 8.3

Starting from WC 8.3 (Nov. 14, 2023), cart and checkout pages are automatically replaced by blocks in new installations. While we are actively working on supporting both blocks, we are not yet prepared to ship them. Stay tuned to our blog to stay informed about Bootscore’s support for those blocks.

If you’re on a new installation of WC ≥ 8.3, replace both blocks with the blockified shortcode versions or the default and proven shortcodes:

  • Go to the backend, navigate to Pages, and find the Cart page
  • Delete cart block and add the default shortcode
[woocommerce_cart]
  • Go to the backend, navigate to Pages, and find the Checkout page
  • Delete cart block and add the default shortcode
[woocommerce_checkout]