Astra_Enqueue_Scripts::should_load_add_to_cart_quantity_btn_script()
Check if add to cart quantity button script should be loaded based on specific conditions
Description
Return
(bool) Whether add to cart quantity button script should be loaded
Source
File: inc/core/class-astra-enqueue-scripts.php
public static function should_load_add_to_cart_quantity_btn_script() {
// 1. Check if the Cart Widget is present in the header.
if ( self::has_cart_widget_in_header() ) {
return true;
}
// 2. Check for Product Block or Shortcode.
if ( self::has_product_block_or_shortcode() ) {
return true;
}
// 3. Check if we are on the Single Product or the Cart Page.
if ( is_product() || is_cart() || is_shop() ) {
return true;
}
// 4. Check with Elementor's product widget.
if ( self::has_elementor_product_widget() ) {
return true;
}
return false;
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.11.18 | Introduced. |