Fix: Cart quantity +/- buttons not working

Date: July 6, 2026
Ticket: #121155
Site: tqmeats.com
File modified: wp-content/themes/astra-child/functions.php (via FTP)

Issue

On the cart page, the +/- quantity buttons rendered as inert placeholders (.ast-qty-placeholder) but weren’t clickable — no click handlers were bound, though jQuery loaded fine and there were no console errors.

Root cause

Astra’s theme logic (should_load_add_to_cart_quantity_btn_script()) should enqueue its add-to-cart-quantity-btn.min.js script on the cart page, and the placeholder rendering confirmed the relevant customizer option was enabled. Despite that, the script was never actually output on the live page — confirmed by fetching the rendered HTML directly and finding no matching <script> tag.

The exact reason the native enqueue was failing wasn’t confirmed (would require checking the live database value of the single-product-plus-minus-button option, which needs SSH/WP-CLI — only FTP access was available for this site). Rather than chase that further, the fix below force-loads Astra’s own script directly, bypassing whatever condition was silently failing.

Fix applied

Added the following to the bottom of astra-child/functions.php:

/**
 * Fix: Astra's cart quantity +/- buttons render as inert placeholders
 * (.ast-qty-placeholder) but the activation script never gets enqueued
 * on the cart page, even though is_cart() should satisfy Astra's own
 * should_load_add_to_cart_quantity_btn_script() check. Root cause not
 * confirmed (requires DB inspection of the astra-settings option, not
 * accessible via FTP-only access) — this force-enqueues the same script
 * Astra ships, with the same localized data it expects, as a reliable
 * workaround. Ticket #121155.
 */
add_action( 'wp_enqueue_scripts', function() {

	if ( ! function_exists( 'is_cart' ) || ! is_cart() ) {
		return;
	}

	if ( wp_script_is( 'astra-add-to-cart-quantity-btn', 'enqueued' ) ) {
		return; // Astra already loaded it natively — don't double-bind.
	}

	wp_enqueue_script(
		'tqm-cart-qty-btn-fix',
		get_template_directory_uri() . '/assets/js/minified/add-to-cart-quantity-btn.min.js',
		array( 'jquery' ),
		CHILD_THEME_ASTRA_CHILD_VERSION,
		true
	);

	wp_localize_script( 'tqm-cart-qty-btn-fix', 'astra_qty_btn', array(
		'plus_qty'   => __( 'Plus Quantity', 'astra' ),
		'minus_qty'  => __( 'Minus Quantity', 'astra' ),
		'style_type' => 'normal',
	) );

}, 100 );

Notes / caveats

  • This is a workaround, not a fix to Astra’s underlying bug. It has a built-in safety check (wp_script_is(...'enqueued')) so it won’t double-load the script if a future Astra update fixes the native enqueue itself.
  • Hardcodes button style as 'normal' — if the site’s quantity button style setting is changed in the Customizer later, this won’t reflect that (cosmetic only).
  • Path to the JS file is hardcoded to Astra’s current file structure — if a theme update relocates/renames that file, this fix will silently stop working (script tag won’t render, buttons go back to being broken) rather than causing an error.
  • Flag: there’s a pending Astra theme update and several plugin updates on this site — re-test the cart quantity buttons after those run, in case the update changes this file’s path or fixes the root cause.

Scroll to Top