ASTRA_Ext_WooCommerce_Markup::shop_js_localize( array $localize )
Infinite Products Show on scroll
Description
Parameters
- $localize
-
(array) (Required) JS localize variables.
Return
(array)
Source
File: addons/woocommerce/classes/class-astra-ext-woocommerce-markup.php
public function shop_js_localize( $localize ) { global $wp_query; $single_ajax_add_to_cart = astra_get_option( 'single-product-ajax-add-to-cart' ); if ( is_singular( 'product' ) ) { $product = wc_get_product( get_the_id() ); if ( false !== $product && $product->is_type( 'external' ) ) { // Disable Ajax Add to Cart feature for External/Affiliate product. $single_ajax_add_to_cart = false; } } $shop_pagination = astra_get_option( 'shop-pagination' ); $shop_infinite_scroll_event = astra_get_option( 'shop-infinite-scroll-event' ); $localize['edit_post_url'] = admin_url( 'post.php?post={{id}}&action=edit' ); $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); $localize['shop_infinite_count'] = 2; $localize['shop_infinite_total'] = $wp_query->max_num_pages; $localize['shop_pagination'] = $shop_pagination; $localize['shop_infinite_scroll_event'] = $shop_infinite_scroll_event; $localize['shop_no_more_post_message'] = apply_filters( 'astra_shop_no_more_product_text', __( 'No more products to show.', 'astra-addon' ) ); $localize['checkout_prev_text'] = __( 'Back to my details', 'astra-addon' ); $localize['checkout_next_text'] = __( 'Proceed to payment', 'astra-addon' ); $localize['show_comments'] = __( 'Show Comments', 'astra-addon' ); $localize['shop_quick_view_enable'] = astra_get_option( 'shop-quick-view-enable' ); $localize['shop_quick_view_stick_cart'] = astra_get_option( 'shop-quick-view-stick-cart' ); $localize['shop_quick_view_auto_height'] = true; $localize['single_product_ajax_add_to_cart'] = $single_ajax_add_to_cart; $localize['is_cart'] = is_cart(); $localize['is_single_product'] = is_product(); $localize['view_cart'] = esc_attr__( 'View cart', 'astra-addon' ); $localize['cart_url'] = apply_filters( 'astra_woocommerce_add_to_cart_redirect', wc_get_cart_url() ); return $localize; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.1.0 | Introduced. |