Initial commit: Atomaste website

This commit is contained in:
2025-12-10 12:17:30 -05:00
commit 0b9e5d1605
19260 changed files with 5206382 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
<?php
/**
* Register customizer panels & sections fro Woocommerce.
*
* @package Astra
* @link https://wpastra.com/
* @since Astra 1.1.0
* @since 1.4.6 Chnaged to using Astra_Customizer API
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'Astra_Customizer_Register_Woo_Section' ) ) {
/**
* Customizer Sanitizes Initial setup
*/
class Astra_Customizer_Register_Woo_Section extends Astra_Customizer_Config_Base {
/**
* Register Panels and Sections for Customizer.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 1.4.3
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
$configs = array(
array(
'name' => 'section-woo-shop',
'title' => __( 'Shop', 'astra' ),
'type' => 'section',
'priority' => 20,
'panel' => 'woocommerce',
),
array(
'name' => 'section-woo-shop-single',
'type' => 'section',
'title' => __( 'Single Product', 'astra' ),
'priority' => 12,
'panel' => 'woocommerce',
),
array(
'name' => 'section-woo-shop-cart',
'type' => 'section',
'title' => __( 'Cart', 'astra' ),
'priority' => 20,
'panel' => 'woocommerce',
),
array(
'name' => 'section-woo-general',
'title' => __( 'General', 'astra' ),
'type' => 'section',
'priority' => 10,
'panel' => 'woocommerce',
),
array(
'name' => 'section-woo-misc',
'title' => __( 'Misc', 'astra' ),
'type' => 'section',
'priority' => 24.5,
'panel' => 'woocommerce',
),
);
return array_merge( $configurations, $configs );
}
}
}
new Astra_Customizer_Register_Woo_Section();

View File

@@ -0,0 +1,91 @@
<?php
/**
* Container Options for Astra theme.
*
* @package Astra
* @link https://www.brainstormforce.com
* @since Astra 1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Woo_Shop_Container_Configs' ) ) {
/**
* Customizer Sanitizes Initial setup
*/
class Astra_Woo_Shop_Container_Configs extends Astra_Customizer_Config_Base {
/**
* Register Astra-WooCommerce Shop Container Settings.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 1.4.3
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
$_configs = array(
/**
* Option: Revamped Container Layout.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woocommerce-ast-content-layout]',
'type' => 'control',
'control' => 'ast-radio-image',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ),
'section' => 'section-woo-general',
'default' => astra_get_option( 'woocommerce-ast-content-layout' ),
'priority' => 5,
'title' => __( 'Container Layout', 'astra' ),
'choices' => array(
'default' => array(
'label' => __( 'Default', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '',
),
'normal-width-container' => array(
'label' => __( 'Normal', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'normal-width-container', false ) : '',
),
'full-width-container' => array(
'label' => __( 'Full Width', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'full-width-container', false ) : '',
),
),
'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-spacing' ),
),
/**
* Option: Content Style Option.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woocommerce-content-style]',
'type' => 'control',
'control' => 'ast-selector',
'section' => 'section-woo-general',
'default' => astra_get_option( 'woocommerce-content-style', 'default' ),
'priority' => 5,
'title' => __( 'Container Style', 'astra' ),
'description' => __( 'Container style will apply only when layout is set to either normal or narrow.', 'astra' ),
'choices' => array(
'default' => __( 'Default', 'astra' ),
'unboxed' => __( 'Unboxed', 'astra' ),
'boxed' => __( 'Boxed', 'astra' ),
),
'renderAs' => 'text',
'responsive' => false,
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
),
);
return array_merge( $configurations, $_configs );
}
}
}
new Astra_Woo_Shop_Container_Configs();

View File

@@ -0,0 +1,112 @@
<?php
/**
* Content Spacing Options for our theme.
*
* @package Astra
* @link https://www.brainstormforce.com
* @since Astra 1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Woo_Shop_Sidebar_Configs' ) ) {
/**
* Customizer Sanitizes Initial setup
*/
class Astra_Woo_Shop_Sidebar_Configs extends Astra_Customizer_Config_Base {
/**
* Register Astra-WooCommerce Shop Sidebar Configurations.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 1.4.3
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
$_configs = array(
/**
* Option: Sidebar Layout.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woocommerce-sidebar-layout]',
'type' => 'control',
'control' => 'ast-radio-image',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ),
'section' => 'section-woo-general',
'default' => astra_get_option( 'woocommerce-sidebar-layout' ),
'priority' => 5,
'title' => __( 'Sidebar Layout', 'astra' ),
'choices' => array(
'default' => array(
'label' => __( 'Default', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '',
),
'no-sidebar' => array(
'label' => __( 'No Sidebar', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'no-sidebar', false ) : '',
),
'left-sidebar' => array(
'label' => __( 'Left Sidebar', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'left-sidebar', false ) : '',
),
'right-sidebar' => array(
'label' => __( 'Right Sidebar', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'right-sidebar', false ) : '',
),
),
'description' => __( 'Sidebar will only apply when container layout is set to normal.', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
),
/**
* Option: Woocommerce Sidebar Style.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woocommerce-sidebar-style]',
'type' => 'control',
'control' => 'ast-selector',
'section' => 'section-woo-general',
'default' => astra_get_option( 'woocommerce-sidebar-style', 'default' ),
'priority' => 5,
'title' => __( 'Sidebar Style', 'astra' ),
'choices' => array(
'default' => __( 'Default', 'astra' ),
'unboxed' => __( 'Unboxed', 'astra' ),
'boxed' => __( 'Boxed', 'astra' ),
),
'responsive' => false,
'renderAs' => 'text',
'divider' => array( 'ast_class' => 'ast-top-divider' ),
),
/**
* Option: Divider
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-display-options-divider]',
'section' => 'woocommerce_product_catalog',
'title' => __( 'Shop Display Options', 'astra' ),
'type' => 'control',
'control' => 'ast-heading',
'priority' => 9.5,
'settings' => array(),
'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-spacing' ),
),
);
return array_merge( $configurations, $_configs );
}
}
}
new Astra_Woo_Shop_Sidebar_Configs();

View File

@@ -0,0 +1,114 @@
<?php
/**
* Store Notice options for Astra Theme.
*
* @package Astra
* @link https://wpastra.com/
* @since Astra 3.9.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Customizer WooCommerece store notice - customizer config initial setup.
*/
class Astra_Woo_Store_Notice_Configs extends Astra_Customizer_Config_Base {
/**
* Register Astra-WooCommerce Shop Cart Layout Customizer Configurations.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 3.9.0
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
$_configs = array(
/**
* Option: Transparent Header Builder - HTML Elements configs.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woo-store-notice-colors-group]',
'default' => astra_get_option( 'woo-store-notice-colors-group' ),
'type' => 'control',
'control' => 'ast-color-group',
'title' => __( 'Color', 'astra' ),
'section' => 'woocommerce_store_notice',
'transport' => 'postMessage',
'priority' => 50,
'context' => array(
array(
'setting' => 'woocommerce_demo_store',
'operator' => '==',
'value' => true,
),
),
'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-divider' ),
),
// Option: Text Color.
array(
'name' => 'store-notice-text-color',
'default' => astra_get_option( 'store-notice-text-color' ),
'parent' => ASTRA_THEME_SETTINGS . '[woo-store-notice-colors-group]',
'type' => 'sub-control',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'section' => 'woocommerce_store_notice',
'transport' => 'postMessage',
'priority' => 1,
'title' => __( 'Text', 'astra' ),
),
// Option: Background Color.
array(
'name' => 'store-notice-background-color',
'default' => astra_get_option( 'store-notice-background-color' ),
'parent' => ASTRA_THEME_SETTINGS . '[woo-store-notice-colors-group]',
'type' => 'sub-control',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'section' => 'woocommerce_store_notice',
'transport' => 'postMessage',
'priority' => 2,
'title' => __( 'Background', 'astra' ),
),
/**
* Option: Notice Position
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[store-notice-position]',
'default' => astra_get_option( 'store-notice-position' ),
'type' => 'control',
'control' => 'ast-selector',
'section' => 'woocommerce_store_notice',
'transport' => 'postMessage',
'priority' => 60,
'title' => __( 'Notice Position', 'astra' ),
'choices' => array(
'hang-over-top' => __( 'Hang Over Top', 'astra' ),
'top' => __( 'Top', 'astra' ),
'bottom' => __( 'Bottom', 'astra' ),
),
'context' => array(
array(
'setting' => 'woocommerce_demo_store',
'operator' => '==',
'value' => true,
),
),
'renderAs' => 'text',
'responsive' => false,
),
);
return array_merge( $configurations, $_configs );
}
}
new Astra_Woo_Store_Notice_Configs();

View File

@@ -0,0 +1,186 @@
<?php
/**
* WooCommerce Options for Astra Theme.
*
* @package Astra
* @link https://wpastra.com/
* @since Astra 1.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Woo_Shop_Cart_Layout_Configs' ) ) {
/**
* Customizer Sanitizes Initial setup
*/
class Astra_Woo_Shop_Cart_Layout_Configs extends Astra_Customizer_Config_Base {
/**
* Register Astra-WooCommerce Shop Cart Layout Customizer Configurations.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 1.4.3
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
$_configs = array(
/**
* Option: Enable checkout button text
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woo-enable-cart-button-text]',
'default' => astra_get_option( 'woo-enable-cart-button-text' ),
'type' => 'control',
'section' => 'section-woo-shop-cart',
'title' => __( 'Change Cart Button Text', 'astra' ),
'description' => __( 'Add custom text for cart button', 'astra' ),
'control' => 'ast-toggle-control',
'priority' => 2,
),
/**
* Option: Checkout
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woo-cart-button-text]',
'default' => astra_get_option( 'woo-cart-button-text' ),
'type' => 'control',
'section' => 'section-woo-shop-cart',
'title' => __( 'Cart Button Text', 'astra' ),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[woo-enable-cart-button-text]',
'operator' => '==',
'value' => true,
),
),
'control' => 'text',
'priority' => 2,
),
/**
* Option: Cart upsells
*
* Enable Cross-sells - in the code it is refrenced as upsells rather than cross-sells.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[enable-cart-upsells]',
'section' => 'section-woo-shop-cart',
'type' => 'control',
'control' => 'ast-toggle-control',
'default' => astra_get_option( 'enable-cart-upsells' ),
'title' => __( 'Enable Cross-sells', 'astra' ),
'priority' => 2.7,
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
);
if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '8.3', '>=' ) ) {
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[woo-block-incompatible-cart-notice]',
'type' => 'control',
'control' => 'ast-description',
'section' => 'section-woo-shop-cart',
'priority' => 1,
'label' => '',
'help' => '<p style="margin-bottom: 20px;>"><strong>' . __( 'Note:', 'astra' ) . '</strong>' . __( ' Certain Cart page options may not work smoothly on the block editor based Cart page. For best results with these features, prefer using a shortcode based Cart page.', 'astra' ) . '</p>',
);
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[woo-block-incompatible-checkout-notice]',
'type' => 'control',
'control' => 'ast-description',
'section' => 'woocommerce_checkout',
'priority' => 1,
'label' => '',
'help' => '<p style="margin-bottom: 20px;>"><strong>' . __( 'Note:', 'astra' ) . '</strong>' . __( ' Certain Checkout page options may not work smoothly on the block editor based Checkout page. For best results with these features, prefer using a shortcode-based Checkout page.', 'astra' ) . '</p>',
);
}
if ( astra_showcase_upgrade_notices() ) {
// Learn More link if Astra Pro is not activated.
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[ast-woo-cart-pro-items]',
'type' => 'control',
'control' => 'ast-upgrade',
'campaign' => 'woocommerce',
'renderAs' => 'list',
'choices' => array(
'two' => array(
'title' => __( 'Modern cart layout', 'astra' ),
),
'one' => array(
'title' => __( 'Sticky cart totals', 'astra' ),
),
'three' => array(
'title' => __( 'Real-time quantity updater', 'astra' ),
),
),
'section' => 'section-woo-shop-cart',
'default' => '',
'priority' => 999,
'title' => __( 'Convert more, earn more with extensive cart conversion features', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
'context' => array(),
);
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[ast-woo-checkout-pro-items]',
'type' => 'control',
'control' => 'ast-upgrade',
'campaign' => 'woocommerce',
'renderAs' => 'list',
'choices' => array(
'two' => array(
'title' => __( 'Modern layout', 'astra' ),
),
'one' => array(
'title' => __( 'Multi-column layouts', 'astra' ),
),
'three' => array(
'title' => __( 'Modern order received layout', 'astra' ),
),
'four' => array(
'title' => __( 'Sticky order review', 'astra' ),
),
'five' => array(
'title' => __( 'Two-step checkout', 'astra' ),
),
'six' => array(
'title' => __( 'Order note, Coupon field control', 'astra' ),
),
'seven' => array(
'title' => __( 'Distraction free checkout', 'astra' ),
),
'eight' => array(
'title' => __( 'Persistent checkout form data', 'astra' ),
),
'nine' => array(
'title' => __( 'Text form options', 'astra' ),
),
'ten' => array(
'title' => __( 'Summary, Payment background', 'astra' ),
),
),
'section' => 'woocommerce_checkout',
'default' => '',
'priority' => 999,
'title' => __( 'Encourage last-minute purchases with extra conversion options at checkout', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
'context' => array(),
);
}
return array_merge( $configurations, $_configs );
}
}
}
new Astra_Woo_Shop_Cart_Layout_Configs();

View File

@@ -0,0 +1,438 @@
<?php
/**
* WooCommerce Options for Astra Theme.
*
* @package Astra
* @link https://wpastra.com/
* @since Astra 1.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Woo_Shop_Layout_Configs' ) ) {
/**
* Customizer Sanitizes Initial setup
*/
class Astra_Woo_Shop_Layout_Configs extends Astra_Customizer_Config_Base {
/**
* Register Astra-WooCommerce Shop Layout Customizer Configurations.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 1.4.3
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$astra_addon_with_woo = ( astra_has_pro_woocommerce_addon() ) ? true : false;
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$add_to_cart_attr = array();
$ratings = array();
$astra_shop_page_pro_features = array();
if ( $astra_addon_with_woo ) {
$astra_shop_page_pro_features = array(
'redirect_cart_page' => __( 'Redirect To Cart Page', 'astra' ),
'redirect_checkout_page' => __( 'Redirect To Checkout Page', 'astra' ),
);
}
/**
* Shop product add to cart control.
*/
$add_to_cart_attr['add_cart'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'add_cart',
'clone_limit' => 2,
'title' => __( 'Add To Cart', 'astra' ),
);
/**
* Shop product total review count.
*/
$ratings['ratings'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'ratings',
'clone_limit' => 2,
'title' => __( 'Ratings', 'astra' ),
);
if ( $astra_addon_with_woo ) {
$current_shop_layouts = array(
'shop-page-grid-style' => array(
'label' => __( 'Design 1', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'shop-grid-view', false ) : '',
),
'shop-page-modern-style' => array(
'label' => __( 'Design 2', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'shop-modern-view', false ) : '',
),
'shop-page-list-style' => array(
'label' => __( 'Design 3', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'shop-list-view', false ) : '',
),
);
} else {
$current_shop_layouts = array(
'shop-page-grid-style' => array(
'label' => __( 'Design 1', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'shop-grid-view', false ) : '',
),
'shop-page-modern-style' => array(
'label' => __( 'Design 2', 'astra' ),
'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'shop-modern-view', false ) : '',
),
);
}
$_configs = array(
/**
* Option: Context for shop archive section.
*/
array(
'name' => 'section-woocommerce-shop-context-tabs',
'section' => 'woocommerce_product_catalog',
'type' => 'control',
'control' => 'ast-builder-header-control',
'priority' => 0,
'description' => '',
),
/**
* Option: Divider
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-box-styling]',
'section' => 'woocommerce_product_catalog',
'title' => __( 'Shop Card Styling', 'astra' ),
'type' => 'control',
'control' => 'ast-heading',
'priority' => 229,
'settings' => array(),
'context' => array(
Astra_Builder_Helper::$design_tab_config,
),
),
/**
* Option: Content Alignment
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-product-align-responsive]',
'default' => astra_get_option( 'shop-product-align-responsive' ),
'type' => 'control',
'control' => 'ast-selector',
'section' => 'woocommerce_product_catalog',
'priority' => 229,
'title' => __( 'Horizontal Content Alignment', 'astra' ),
'responsive' => true,
'choices' => array(
'align-left' => 'align-left',
'align-center' => 'align-center',
'align-right' => 'align-right',
),
'context' => array(
Astra_Builder_Helper::$design_tab_config,
),
'divider' => ! defined( 'ASTRA_EXT_VER' ) ? array( 'ast_class' => 'ast-section-spacing' ) : array( 'ast_class' => 'ast-bottom-section-divider ast-section-spacing' ),
),
/**
* Option: Divider
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woo-shop-structure-divider]',
'section' => 'woocommerce_product_catalog',
'title' => __( 'Shop Card Structure', 'astra' ),
'type' => 'control',
'control' => 'ast-heading',
'priority' => 15,
'settings' => array(),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Single Post Meta
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-product-structure]',
'type' => 'control',
'control' => 'ast-sortable',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ),
'section' => 'woocommerce_product_catalog',
'default' => astra_get_option( 'shop-product-structure' ),
'priority' => 15,
'choices' => array_merge(
array(
'title' => __( 'Title', 'astra' ),
'price' => __( 'Price', 'astra' ),
'short_desc' => __( 'Short Description', 'astra' ),
),
$add_to_cart_attr,
array(
'category' => __( 'Category', 'astra' ),
),
$ratings,
),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Divider
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woo-shop-skin-divider]',
'section' => 'woocommerce_product_catalog',
'title' => __( 'Shop Layout', 'astra' ),
'type' => 'control',
'control' => 'ast-heading',
'priority' => 7,
'settings' => array(),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Choose Product Style
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-style]',
'default' => astra_get_option( 'shop-style' ),
'type' => 'control',
'section' => 'woocommerce_product_catalog',
'title' => __( 'Shop Card Design', 'astra' ),
'control' => 'ast-radio-image',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ),
'priority' => 8,
'choices' => $current_shop_layouts,
'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-section-divider' ),
),
/**
* Option: Shop Columns
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-grids]',
'type' => 'control',
'control' => 'ast-responsive-slider',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ),
'section' => 'woocommerce_product_catalog',
'default' => astra_get_option(
'shop-grids',
array(
'desktop' => 4,
'tablet' => 3,
'mobile' => 2,
)
),
'priority' => 9,
'title' => __( 'Shop Columns', 'astra' ),
'input_attrs' => array(
'step' => 1,
'min' => 1,
'max' => 6,
),
'divider' => array( 'ast_class' => 'ast-bottom-section-divider' ),
),
/**
* Option: Products Per Page
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-no-of-products]',
'type' => 'control',
'section' => 'woocommerce_product_catalog',
'title' => __( 'Products Per Page', 'astra' ),
'default' => astra_get_option( 'shop-no-of-products' ),
'control' => 'number',
'priority' => 9,
'input_attrs' => array(
'min' => 1,
'step' => 1,
'max' => 100,
),
),
/**
* Option: Shop Archive Content Width
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-archive-width]',
'type' => 'control',
'control' => 'ast-selector',
'section' => 'woocommerce_product_catalog',
'default' => astra_get_option( 'shop-archive-width' ),
'priority' => 9,
'title' => __( 'Shop Archive Content Width', 'astra' ),
'choices' => array(
'default' => __( 'Default', 'astra' ),
'custom' => __( 'Custom', 'astra' ),
),
'transport' => 'refresh',
'renderAs' => 'text',
'responsive' => false,
'divider' => $astra_addon_with_woo ? array( 'ast_class' => 'ast-top-section-divider' ) : array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Enter Width
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[shop-archive-max-width]',
'type' => 'control',
'control' => 'ast-slider',
'section' => 'woocommerce_product_catalog',
'default' => astra_get_option( 'shop-archive-max-width' ),
'priority' => 9,
'title' => __( 'Custom Width', 'astra' ),
'transport' => 'postMessage',
'suffix' => 'px',
'input_attrs' => array(
'min' => 768,
'step' => 1,
'max' => 1920,
),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[shop-archive-width]',
'operator' => '===',
'value' => 'custom',
),
),
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
),
);
/**
* Option: Shop add to cart action.
*/
$_configs[] = array(
'name' => 'shop-add-to-cart-action',
'parent' => ASTRA_THEME_SETTINGS . '[shop-product-structure]',
'default' => astra_get_option( 'shop-add-to-cart-action' ),
'section' => 'woocommerce_product_catalog',
'title' => __( 'Add To Cart Action', 'astra' ),
'type' => 'sub-control',
'control' => 'ast-select',
'linked' => 'add_cart',
'priority' => 10,
'choices' =>
array_merge(
array(
'default' => __( 'Default', 'astra' ),
'slide_in_cart' => __( 'Slide In Cart', 'astra' ),
),
$astra_shop_page_pro_features
),
'responsive' => false,
'renderAs' => 'text',
'transport' => 'postMessage',
);
/**
* Total Review count option config.
*/
$_configs[] = array(
'name' => 'shop-ratings-product-archive',
'parent' => ASTRA_THEME_SETTINGS . '[shop-product-structure]',
'default' => astra_get_option( 'shop-ratings-product-archive' ),
'linked' => 'ratings',
'type' => 'sub-control',
'control' => 'ast-selector',
'section' => 'woocommerce_product_catalog',
'priority' => 10,
'title' => __( 'Review Count', 'astra' ),
'choices' => array(
'default' => __( 'Default', 'astra' ),
'count_string' => __( 'Count + Text', 'astra' ),
),
'transport' => 'postMessage',
'responsive' => false,
'renderAs' => 'text',
);
/**
* Option: Shop add to cart action notice.
*/
$_configs[] = array(
'name' => 'shop-add-to-cart-action-notice',
'parent' => ASTRA_THEME_SETTINGS . '[shop-product-structure]',
'type' => 'sub-control',
'control' => 'ast-description',
'section' => 'woocommerce_product_catalog',
'priority' => 10,
'label' => '',
'linked' => 'add_cart',
'help' => __( 'Please publish the changes and see result on the frontend.<br />[Slide in cart requires Cart added inside Header Builder]', 'astra' ),
);
// Learn More link if Astra Pro is not activated.
if ( astra_showcase_upgrade_notices() ) {
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[ast-woo-shop-pro-items]',
'type' => 'control',
'control' => 'ast-upgrade',
'campaign' => 'woocommerce',
'renderAs' => 'list',
'choices' => array(
'two' => array(
'title' => __( 'More shop design layouts', 'astra' ),
),
'three' => array(
'title' => __( 'Shop toolbar structure', 'astra' ),
),
'five' => array(
'title' => __( 'Offcanvas product filters', 'astra' ),
),
'six' => array(
'title' => __( 'Products quick view', 'astra' ),
),
'seven' => array(
'title' => __( 'Shop pagination', 'astra' ),
),
'eight' => array(
'title' => __( 'More typography options', 'astra' ),
),
'nine' => array(
'title' => __( 'More color options', 'astra' ),
),
'ten' => array(
'title' => __( 'More spacing options', 'astra' ),
),
'four' => array(
'title' => __( 'Box shadow design options', 'astra' ),
),
'one' => array(
'title' => __( 'More design controls', 'astra' ),
),
),
'section' => 'woocommerce_product_catalog',
'default' => '',
'priority' => 999,
'title' => __( 'Optimize your WooCommerce store for maximum profit with enhanced features', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
'context' => array(),
);
}
$configurations = array_merge( $configurations, $_configs );
return $configurations;
}
}
}
new Astra_Woo_Shop_Layout_Configs();

View File

@@ -0,0 +1,111 @@
<?php
/**
* WooCommerce Options for Astra Theme.
*
* @package Astra
* @link https://wpastra.com/
* @since Astra 3.9.2
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Woo_Shop_Misc_Layout_Configs' ) ) {
/**
* Customizer Sanitizes Initial setup
*/
class Astra_Woo_Shop_Misc_Layout_Configs extends Astra_Customizer_Config_Base {
/**
* Register Astra-WooCommerce Misc Customizer Configurations.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 3.9.2
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
$_configs = array(
/**
* Option: Enable Quantity Plus and Minus.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-plus-minus-button]',
'default' => astra_get_option( 'single-product-plus-minus-button' ),
'type' => 'control',
'section' => 'section-woo-misc',
'title' => __( 'Enable Quantity Plus and Minus', 'astra' ),
'description' => __( 'Adds plus and minus buttons besides product quantity', 'astra' ),
'priority' => 59,
'control' => 'ast-toggle-control',
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
);
/**
* Option: Adds tabs only if astra addons is enabled.
*/
if ( astra_has_pro_woocommerce_addon() ) {
$_configs[] = array(
'name' => 'section-woo-general-tabs',
'section' => 'section-woo-misc',
'type' => 'control',
'control' => 'ast-builder-header-control',
'priority' => 0,
'description' => '',
);
}
if ( astra_showcase_upgrade_notices() ) {
// Learn More link if Astra Pro is not activated.
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[ast-woo-misc-pro-items]',
'type' => 'control',
'control' => 'ast-upgrade',
'campaign' => 'woocommerce',
'renderAs' => 'list',
'choices' => array(
'two' => array(
'title' => __( 'Modern input style', 'astra' ),
),
'one' => array(
'title' => __( 'Sale badge modifications', 'astra' ),
),
'three' => array(
'title' => __( 'Ecommerce steps navigation', 'astra' ),
),
'four' => array(
'title' => __( 'Quantity updater designs', 'astra' ),
),
'five' => array(
'title' => __( 'Modern my-account page', 'astra' ),
),
'six' => array(
'title' => __( 'Downloads, Orders grid view', 'astra' ),
),
'seven' => array(
'title' => __( 'Modern thank-you page design', 'astra' ),
),
),
'section' => 'section-woo-misc',
'default' => '',
'priority' => 999,
'title' => __( 'Access extra conversion tools to make more profit from your eCommerce store', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
'context' => array(),
);
}
return array_merge( $configurations, $_configs );
}
}
}
new Astra_Woo_Shop_Misc_Layout_Configs();

View File

@@ -0,0 +1,677 @@
<?php
/**
* WooCommerce Options for Astra Theme.
*
* @package Astra
* @link https://wpastra.com/
* @since Astra 1.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Woo_Shop_Single_Layout_Configs' ) ) {
/**
* Customizer Sanitizes Initial setup
*/
class Astra_Woo_Shop_Single_Layout_Configs extends Astra_Customizer_Config_Base {
/**
* Register Astra-WooCommerce Shop Single Layout Customizer Configurations.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 1.4.3
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$product_divider_title = astra_has_pro_woocommerce_addon() ? __( 'Product Structure Options', 'astra' ) : __( 'Product Options', 'astra' );
$clonning_attr = array();
$add_to_cart_attr = array();
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( astra_has_pro_woocommerce_addon() ) {
/**
* Single product extras control.
*/
$clonning_attr['summary-extras'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'summary-extras',
'clone_limit' => 2,
'title' => __( 'Extras', 'astra' ),
);
}
/**
* Single product add to cart control.
*/
$add_to_cart_attr['add_cart'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'add_cart',
'clone_limit' => 2,
'title' => __( 'Add To Cart', 'astra' ),
);
/**
* Single product payment control.
*/
$clonning_attr['single-product-payments'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'single-product-payments',
'clone_limit' => 2,
'title' => __( 'Payments', 'astra' ),
);
$_configs = array(
array(
'name' => 'section-woo-shop-single-ast-context-tabs',
'section' => 'section-woo-shop-single',
'type' => 'control',
'control' => 'ast-builder-header-control',
'priority' => 0,
'description' => '',
),
/**
* Option: Divider.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woo-single-product-structure-divider]',
'section' => 'section-woo-shop-single',
'title' => __( 'Single Product Structure', 'astra' ),
'type' => 'control',
'control' => 'ast-heading',
'priority' => 15,
'settings' => array(),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Single Post Meta
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-structure]',
'default' => astra_get_option( 'single-product-structure' ),
'type' => 'control',
'control' => 'ast-sortable',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ),
'section' => 'section-woo-shop-single',
'priority' => 15,
'choices' => array_merge(
array(
'title' => __( 'Title', 'astra' ),
'price' => __( 'Price', 'astra' ),
'ratings' => __( 'Ratings', 'astra' ),
),
$add_to_cart_attr,
array(
'short_desc' => __( 'Short Description', 'astra' ),
'meta' => __( 'Meta', 'astra' ),
'category' => __( 'Category', 'astra' ),
),
$clonning_attr
),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Divider.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woo-single-product-structure-fields-divider]',
'section' => 'section-woo-shop-single',
'title' => $product_divider_title,
'type' => 'control',
'control' => 'ast-heading',
'priority' => 16,
'settings' => array(),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Disable Breadcrumb
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-breadcrumb-disable]',
'section' => 'section-woo-shop-single',
'type' => 'control',
'control' => 'ast-toggle-control',
'default' => astra_get_option( 'single-product-breadcrumb-disable' ),
'title' => __( 'Enable Breadcrumb', 'astra' ),
'priority' => 16,
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Enable free shipping
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-enable-shipping]',
'default' => astra_get_option( 'single-product-enable-shipping' ),
'type' => 'control',
'section' => 'section-woo-shop-single',
'title' => __( 'Enable Shipping Text', 'astra' ),
'description' => __( 'Adds shipping text next to the product price.', 'astra' ),
'control' => 'ast-toggle-control',
'priority' => 16,
),
/**
* Option: Single page variation tab layout.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-variation-tabs-layout]',
'default' => astra_get_option( 'single-product-variation-tabs-layout' ),
'type' => 'control',
'section' => 'section-woo-shop-single',
'title' => __( 'Product Variation Layout', 'astra' ),
'description' => __( 'Changes single product variation layout to be displayed inline or stacked.', 'astra' ),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
),
'control' => 'ast-selector',
'priority' => 17,
'choices' => array(
'horizontal' => __( 'Inline', 'astra' ),
'vertical' => __( 'Stack', 'astra' ),
),
'renderAs' => 'text',
'responsive' => false,
),
/**
* Option: Disable Transparent Header on WooCommerce Product pages
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-woo-products]',
'default' => astra_get_option( 'transparent-header-disable-woo-products' ),
'type' => 'control',
'section' => 'section-transparent-header',
'title' => __( 'Disable on WooCommerce Product Pages?', 'astra' ),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]',
'operator' => '==',
'value' => '1',
),
),
'priority' => 26,
'control' => 'ast-toggle-control',
),
/**
* Option: Free shipping text
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-shipping-text]',
'default' => astra_get_option( 'single-product-shipping-text' ),
'type' => 'control',
'section' => 'section-woo-shop-single',
'title' => __( 'Shipping Text', 'astra' ),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[single-product-enable-shipping]',
'operator' => '==',
'value' => true,
),
),
'control' => 'text',
'priority' => 16,
'divider' => array( 'ast_class' => 'ast-bottom-spacing' ),
),
/**
* Option: Divider.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-divider]',
'section' => 'section-woo-shop-single',
'title' => __( 'Sticky Add To Cart', 'astra' ),
'type' => 'control',
'control' => 'ast-heading',
'priority' => 76,
'settings' => array(),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Sticky add to cart.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart]',
'default' => astra_get_option( 'single-product-sticky-add-to-cart' ),
'type' => 'control',
'section' => 'section-woo-shop-single',
'title' => __( 'Enable Sticky Add to Cart', 'astra' ),
'control' => 'ast-toggle-control',
'priority' => 76,
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Sticky add to cart position.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-position]',
'default' => astra_get_option( 'single-product-sticky-add-to-cart-position' ),
'type' => 'control',
'control' => 'ast-selector',
'section' => 'section-woo-shop-single',
'priority' => 76,
'title' => __( 'Sticky Placement ', 'astra' ),
'choices' => array(
'top' => __( 'Top', 'astra' ),
'bottom' => __( 'Bottom', 'astra' ),
),
'transport' => 'postMessage',
'renderAs' => 'text',
'responsive' => false,
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart]',
'operator' => '==',
'value' => true,
),
),
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
),
/**
* Option: Divider.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[woo-single-product-sticky-color-divider]',
'section' => 'section-woo-shop-single',
'title' => __( 'Sticky Add To Cart Colors', 'astra' ),
'type' => 'control',
'control' => 'ast-heading',
'priority' => 82,
'settings' => array(),
'context' => array(
Astra_Builder_Helper::$design_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart]',
'operator' => '==',
'value' => true,
),
),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Sticky add to cart text color.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-text-color]',
'default' => astra_get_option( 'single-product-sticky-add-to-cart-text-color' ),
'type' => 'control',
'section' => 'section-woo-shop-single',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'transport' => 'postMessage',
'title' => __( 'Text Color', 'astra' ),
'context' => array(
Astra_Builder_Helper::$design_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart]',
'operator' => '==',
'value' => true,
),
),
'priority' => 82,
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Sticky add to cart background color.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-bg-color]',
'default' => astra_get_option( 'single-product-sticky-add-to-cart-bg-color' ),
'type' => 'control',
'section' => 'section-woo-shop-single',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'transport' => 'postMessage',
'title' => __( 'Background Color', 'astra' ),
'context' => array(
Astra_Builder_Helper::$design_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart]',
'operator' => '==',
'value' => true,
),
),
'priority' => 82,
),
/**
* Option: Sticky add to cart button text color.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-btn-color]',
'default' => astra_get_option( 'single-product-sticky-add-to-cart-btn-color' ),
'type' => 'control',
'control' => 'ast-color-group',
'title' => __( 'Button Text', 'astra' ),
'section' => 'section-woo-shop-single',
'transport' => 'postMessage',
'priority' => 82,
'context' => array(
Astra_Builder_Helper::$design_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart]',
'operator' => '==',
'value' => true,
),
),
),
/**
* Option: Link Color.
*/
array(
'type' => 'sub-control',
'priority' => 76,
'parent' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-btn-color]',
'section' => 'section-woo-shop-single',
'control' => 'ast-color',
'default' => astra_get_option( 'single-product-sticky-add-to-cart-btn-n-color' ),
'name' => 'single-product-sticky-add-to-cart-btn-n-color',
'title' => __( 'Normal', 'astra' ),
'tab' => __( 'Normal', 'astra' ),
),
/**
* Option: Link Hover Color.
*/
array(
'type' => 'sub-control',
'priority' => 82,
'parent' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-btn-color]',
'section' => 'section-woo-shop-single',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'default' => astra_get_option( 'single-product-sticky-add-to-cart-btn-h-color' ),
'transport' => 'postMessage',
'name' => 'single-product-sticky-add-to-cart-btn-h-color',
'title' => __( 'Hover', 'astra' ),
'tab' => __( 'Hover', 'astra' ),
),
/**
* Option: Sticky add to cart button background color.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-btn-bg-color]',
'default' => astra_get_option( 'single-product-sticky-add-to-cart-btn-bg-color' ),
'type' => 'control',
'control' => 'ast-color-group',
'title' => __( 'Button Background', 'astra' ),
'section' => 'section-woo-shop-single',
'transport' => 'postMessage',
'priority' => 82,
'context' => array(
Astra_Builder_Helper::$design_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart]',
'operator' => '==',
'value' => true,
),
),
),
/**
* Option: Link Color.
*/
array(
'type' => 'sub-control',
'priority' => 82,
'parent' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-btn-bg-color]',
'section' => 'section-woo-shop-single',
'control' => 'ast-color',
'default' => astra_get_option( 'single-product-sticky-add-to-cart-btn-bg-n-color' ),
'name' => 'single-product-sticky-add-to-cart-btn-bg-n-color',
'title' => __( 'Normal', 'astra' ),
'tab' => __( 'Normal', 'astra' ),
),
/**
* Option: Link Hover Color.
*/
array(
'type' => 'sub-control',
'priority' => 82,
'parent' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart-btn-bg-color]',
'section' => 'section-woo-shop-single',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'default' => astra_get_option( 'single-product-sticky-add-to-cart-btn-bg-h-color' ),
'transport' => 'postMessage',
'name' => 'single-product-sticky-add-to-cart-btn-bg-h-color',
'title' => __( 'Hover', 'astra' ),
'tab' => __( 'Hover', 'astra' ),
),
/**
* Single product payment icon color style.
*/
array(
'name' => 'single-product-payment-icon-color',
'parent' => ASTRA_THEME_SETTINGS . '[single-product-structure]',
'default' => astra_get_option( 'single-product-payment-icon-color' ),
'linked' => 'single-product-payments',
'type' => 'sub-control',
'control' => 'ast-selector',
'section' => 'section-woo-shop-single',
'priority' => 5,
'title' => __( 'Choose Icon Colors', 'astra' ),
'choices' => array(
'inherit' => __( 'Default', 'astra' ),
'inherit_text_color' => __( 'Grayscale', 'astra' ),
),
'transport' => 'postMessage',
'responsive' => false,
'renderAs' => 'text',
),
/**
* Single product payment heading text.
*/
array(
'name' => 'single-product-payment-text',
'parent' => ASTRA_THEME_SETTINGS . '[single-product-structure]',
'default' => astra_get_option( 'single-product-payment-text' ),
'linked' => 'single-product-payments',
'type' => 'sub-control',
'control' => 'ast-text-input',
'section' => 'section-woo-shop-single',
'priority' => 5,
'transport' => 'postMessage',
'title' => __( 'Payment Title', 'astra' ),
'settings' => array(),
),
);
/**
* Single product extras list.
*/
$_configs[] = array(
'name' => 'single-product-payment-list',
'parent' => ASTRA_THEME_SETTINGS . '[single-product-structure]',
'default' => astra_get_option( 'single-product-payment-list' ),
'linked' => 'single-product-payments',
'type' => 'sub-control',
'control' => 'ast-list-icons',
'section' => 'section-woo-shop-single',
'priority' => 10,
'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
'disable' => false,
'input_attrs' => array(
'text_control_label' => __( 'Payment Title', 'astra' ),
'text_control_placeholder' => __( 'Add payment title', 'astra' ),
),
);
/**
* Option: Button width option
*/
$_configs[] = array(
'name' => 'single-product-cart-button-width',
'parent' => ASTRA_THEME_SETTINGS . '[single-product-structure]',
'default' => astra_get_option( 'single-product-cart-button-width' ),
'linked' => 'add_cart',
'type' => 'sub-control',
'control' => 'ast-responsive-slider',
'responsive' => true,
'section' => 'section-woo-shop-single',
'priority' => 11,
'title' => __( 'Button Width', 'astra' ),
'transport' => 'postMessage',
'suffix' => '%',
'input_attrs' => array(
'min' => 1,
'step' => 1,
'max' => 100,
),
);
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( astra_has_pro_woocommerce_addon() ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$_configs[] = array(
'name' => 'single-product-cart-button-width',
'parent' => ASTRA_THEME_SETTINGS . '[single-product-structure]',
'default' => astra_get_option( 'single-product-cart-button-width' ),
'linked' => 'add_cart',
'type' => 'sub-control',
'control' => 'ast-responsive-slider',
'responsive' => true,
'section' => 'section-woo-shop-single',
'priority' => 11,
'title' => __( 'Button Width', 'astra' ),
'transport' => 'postMessage',
'suffix' => '%',
'input_attrs' => array(
'min' => 1,
'step' => 1,
'max' => 100,
),
);
} else {
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[single-product-cart-button-width]',
'default' => astra_get_option( 'single-product-cart-button-width' ),
'type' => 'control',
'transport' => 'postMessage',
'responsive' => true,
'control' => 'ast-responsive-slider',
'section' => 'section-woo-shop-single',
'title' => __( 'Button Width', 'astra' ),
'suffix' => '%',
'priority' => 16,
'input_attrs' => array(
'min' => 1,
'step' => 1,
'max' => 100,
),
'divider' => array( 'ast_class' => 'ast-top-section-divider ast-bottom-section-divider' ),
);
}
if ( ! defined( 'ASTRA_EXT_VER' ) ) {
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[sticky-add-to-cart-notice]',
'type' => 'control',
'control' => 'ast-description',
'section' => 'section-woo-shop-single',
'priority' => 5,
'label' => '',
'help' => __( 'Note: To get design settings make sure to enable sticky add to cart.', 'astra' ),
'context' => array(
Astra_Builder_Helper::$design_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[single-product-sticky-add-to-cart]',
'operator' => '==',
'value' => false,
),
),
);
if ( astra_showcase_upgrade_notices() ) {
// Learn More link if Astra Pro is not activated.
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[ast-woo-single-product-pro-items]',
'type' => 'control',
'control' => 'ast-upgrade',
'campaign' => 'woocommerce',
'renderAs' => 'list',
'choices' => array(
'two' => array(
'title' => __( 'More product galleries', 'astra' ),
),
'three' => array(
'title' => __( 'Sticky product summary', 'astra' ),
),
'five' => array(
'title' => __( 'Product description layouts', 'astra' ),
),
'six' => array(
'title' => __( 'Related, Upsell product controls', 'astra' ),
),
'seven' => array(
'title' => __( 'Extras option for product structure', 'astra' ),
),
'eight' => array(
'title' => __( 'More typography options', 'astra' ),
),
'nine' => array(
'title' => __( 'More color options', 'astra' ),
),
'one' => array(
'title' => __( 'More design controls', 'astra' ),
),
),
'section' => 'section-woo-shop-single',
'default' => '',
'priority' => 999,
'title' => __( 'Extra conversion options for store product pages means extra profit!', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
'context' => array(),
);
}
}
return array_merge( $configurations, $_configs );
}
}
}
new Astra_Woo_Shop_Single_Layout_Configs();

View File

@@ -0,0 +1,403 @@
<?php
/**
* Custom functions that used for Woocommerce compatibility.
*
* Eventually, some of the functionality here could be replaced by core features.
*
* @package Astra
* @link https://wpastra.com/
* @since Astra 1.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Shop page - Products Title markup updated
*/
if ( ! function_exists( 'astra_woo_shop_products_title' ) ) :
/**
* Shop Page product titles with anchor
*
* @hooked woocommerce_after_shop_loop_item - 10
*
* @since 1.1.0
*/
function astra_woo_shop_products_title() {
echo '<a href="' . esc_url( get_the_permalink() ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
echo '<h2 class="woocommerce-loop-product__title">' . esc_html( get_the_title() ) . '</h2>';
echo '</a>';
}
endif;
/**
* Shop page - Parent Category
*/
if ( ! function_exists( 'astra_woo_shop_parent_category' ) ) :
/**
* Add and/or Remove Categories from shop archive page.
*
* @hooked woocommerce_after_shop_loop_item - 9
*
* @since 1.1.0
*/
function astra_woo_shop_parent_category() {
if ( apply_filters( 'astra_woo_shop_parent_category', true ) ) : ?>
<span class="ast-woo-product-category">
<?php
global $product;
$product_categories = function_exists( 'wc_get_product_category_list' ) ? wc_get_product_category_list( get_the_ID(), ';', '', '' ) : $product->get_categories( ';', '', '' );
$product_categories = html_entity_decode( wp_strip_all_tags( $product_categories ) );
if ( $product_categories ) {
list( $parent_cat ) = explode( ';', $product_categories );
echo apply_filters( 'astra_woo_shop_product_categories', esc_html( $parent_cat ), get_the_ID() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</span>
<?php
endif;
}
endif;
/**
* Shop page - Out of Stock
*/
if ( ! function_exists( 'astra_woo_shop_out_of_stock' ) ) :
/**
* Add Out of Stock to the Shop page
*
* @hooked woocommerce_shop_loop_item_title - 8
*
* @since 1.1.0
*/
function astra_woo_shop_out_of_stock() {
$out_of_stock = get_post_meta( get_the_ID(), '_stock_status', true );
$out_of_stock_string = apply_filters( 'astra_woo_shop_out_of_stock_string', __( 'Out of stock', 'astra' ) );
if ( 'outofstock' === $out_of_stock ) {
?>
<span class="ast-shop-product-out-of-stock"><?php echo esc_html( $out_of_stock_string ); ?></span>
<?php
}
}
endif;
/**
* Shop page - Short Description
*/
if ( ! function_exists( 'astra_woo_shop_product_short_description' ) ) :
/**
* Product short description
*
* @hooked woocommerce_after_shop_loop_item
*
* @since 1.1.0
*/
function astra_woo_shop_product_short_description() {
?>
<?php if ( has_excerpt() ) { ?>
<div class="ast-woo-shop-product-description">
<?php the_excerpt(); ?>
</div>
<?php } ?>
<?php
}
endif;
/**
* Product page - Availability: in stock
*/
if ( ! function_exists( 'astra_woo_product_in_stock' ) ) :
/**
* Availability: in stock string updated
*
* @param string $markup Markup.
* @param object $product Object of Product.
*
* @since 1.1.0
*/
function astra_woo_product_in_stock( $markup, $product ) {
if ( is_product() ) {
$product_avail = $product->get_availability();
$stock_quantity = $product->get_stock_quantity();
$availability = $product_avail['availability'];
$avail_class = $product_avail['class'];
if ( ! empty( $availability ) && $stock_quantity ) {
ob_start();
?>
<p class="ast-stock-detail">
<span class="ast-stock-avail"><?php esc_html_e( 'Availability:', 'astra' ); ?></span>
<span class="stock <?php echo esc_html( $avail_class ); ?>"><?php echo esc_html( $availability ); ?></span>
</p>
<?php
$markup = ob_get_clean();
}
}
return $markup;
}
endif;
if ( ! function_exists( 'astra_woo_woocommerce_template_loop_product_title' ) ) {
/**
* Show the product title in the product loop. By default this is an H2.
*/
function astra_woo_woocommerce_template_loop_product_title() {
$product_title_link = apply_filters( 'astra_woo_shop_product_title_link', '__return_true' );
if ( $product_title_link ) {
echo '<a href="' . esc_url( get_the_permalink() ) . '" class="ast-loop-product__link">';
woocommerce_template_loop_product_title();
echo '</a>';
} else {
woocommerce_template_loop_product_title();
}
}
}
if ( ! function_exists( 'astra_woo_woocommerce_shop_product_content' ) ) {
/**
* Show the product title in the product loop. By default this is an H2.
*/
function astra_woo_woocommerce_shop_product_content() {
$shop_structure = apply_filters( 'astra_woo_shop_product_structure', astra_get_option( 'shop-product-structure' ) );
if ( is_array( $shop_structure ) && ! empty( $shop_structure ) ) {
do_action( 'astra_woo_shop_before_summary_wrap' );
echo '<div class="astra-shop-summary-wrap">';
do_action( 'astra_woo_shop_summary_wrap_top' );
foreach ( $shop_structure as $value ) {
switch ( $value ) {
case 'title':
/**
* Add Product Title on shop page for all products.
*/
do_action( 'astra_woo_shop_title_before' );
astra_woo_woocommerce_template_loop_product_title();
do_action( 'astra_woo_shop_title_after' );
break;
case 'price':
/**
* Add Product Price on shop page for all products.
*/
do_action( 'astra_woo_shop_price_before' );
woocommerce_template_loop_price();
do_action( 'astra_woo_shop_price_after' );
break;
case 'ratings':
/**
* Add rating on shop page for all products.
*/
do_action( 'astra_woo_shop_rating_before' );
woocommerce_template_loop_rating();
do_action( 'astra_woo_shop_rating_after' );
break;
case 'short_desc':
do_action( 'astra_woo_shop_short_description_before' );
astra_woo_shop_product_short_description();
do_action( 'astra_woo_shop_short_description_after' );
break;
case 'add_cart':
do_action( 'astra_woo_shop_add_to_cart_before' );
woocommerce_template_loop_add_to_cart();
do_action( 'astra_woo_shop_add_to_cart_after' );
break;
case 'category':
/**
* Add and/or Remove Categories from shop archive page.
*/
do_action( 'astra_woo_shop_category_before' );
astra_woo_shop_parent_category();
do_action( 'astra_woo_shop_category_after' );
break;
default:
break;
}
}
do_action( 'astra_woo_shop_summary_wrap_bottom' );
echo '</div>';
do_action( 'astra_woo_shop_after_summary_wrap' );
}
}
}
if ( ! function_exists( 'astra_woo_shop_thumbnail_wrap_start' ) ) {
/**
* Thumbnail wrap start.
*/
function astra_woo_shop_thumbnail_wrap_start() {
echo '<div class="astra-shop-thumbnail-wrap">';
}
}
if ( ! function_exists( 'astra_woo_shop_thumbnail_wrap_end' ) ) {
/**
* Thumbnail wrap end.
*/
function astra_woo_shop_thumbnail_wrap_end() {
echo '</div>';
}
}
/**
* Woocommerce filter - Widget Products Tags
*/
if ( ! function_exists( 'astra_widget_product_tag_cloud_args' ) ) {
/**
* Woocommerce filter - Widget Products Tags
*
* @param array $args Tag arguments.
* @return array Modified tag arguments.
*/
function astra_widget_product_tag_cloud_args( $args = array() ) {
$sidebar_link_font_size = astra_get_option( 'font-size-body' );
$sidebar_link_font_size['desktop'] = ( '' != $sidebar_link_font_size['desktop'] ) ? $sidebar_link_font_size['desktop'] : 15;
$args['smallest'] = intval( $sidebar_link_font_size['desktop'] ) - 2;
$args['largest'] = intval( $sidebar_link_font_size['desktop'] ) + 3;
$args['unit'] = 'px';
return apply_filters( 'astra_widget_product_tag_cloud_args', $args );
}
add_filter( 'woocommerce_product_tag_cloud_widget_args', 'astra_widget_product_tag_cloud_args', 90 );
}
/**
* Woocommerce shop/product div close tag.
*/
if ( ! function_exists( 'astra_woocommerce_div_wrapper_close' ) ) :
/**
* Woocommerce shop/product div close tag.
*
* @return void
*/
function astra_woocommerce_div_wrapper_close() {
echo '</div>';
}
endif;
/**
* Checking whether shop page style is selected as modern layout.
*/
if ( ! function_exists( 'astra_is_shop_page_modern_style' ) ) :
/**
* Checking whether shop page style is selected as modern layout.
*
* @return bool true|false.
*/
function astra_is_shop_page_modern_style() {
return ( 'shop-page-modern-style' === astra_get_option( 'shop-style' ) ) ? true : false;
}
endif;
/**
* Check if Woocommerce pro addons is enabled.
*
* @return bool true|false.
*/
function astra_has_pro_woocommerce_addon() {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
return ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'woocommerce' ) ) ? true : false;
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
}
/**
* Support cart color setting to default cart icon, till now with other cart icons have this color compatibility but default one don't have this.
* This case is only for old header layout.
*
* @since 3.9.2
* @return boolean false if it is an existing user, true if not.
*/
function astra_cart_color_default_icon_old_header() {
$astra_settings = get_option( ASTRA_THEME_SETTINGS );
return apply_filters( 'astra_support_default_cart_color_in_old_header', isset( $astra_settings['can-reflect-cart-color-in-old-header'] ) ? false : true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
}
/**
* Function to check the Add to Cart quantity buttons.
*
* @return bool true|false.
* @since 3.9.2
*/
function astra_add_to_cart_quantity_btn_enabled() {
return apply_filters( 'astra_add_to_cart_quantity_btn_enabled', astra_get_option( 'single-product-plus-minus-button' ) );
}
/**
* Woocommerce MyAccount Page Endpoint.
*/
if ( ! function_exists( 'astra_get_wc_endpoints_title' ) ) {
/**
* Woocommerce MyAccount Page Endpoint.
*
* @param string $title for MyAccount title endpoint.
* @return string
*
* @since 4.3.0
*/
function astra_get_wc_endpoints_title( $title ) {
if ( class_exists( 'WooCommerce' ) && is_wc_endpoint_url() && is_account_page() ) {
$endpoint = WC()->query->get_current_endpoint();
$action = isset( $_GET['action'] ) && is_string( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
$ep_title = $endpoint ? WC()->query->get_endpoint_title( $endpoint, $action ) : '';
if ( $ep_title ) {
return $ep_title;
}
}
return $title;
}
add_filter( 'astra_the_title', 'astra_get_wc_endpoints_title' );
}
if ( ! function_exists( 'astra_woocommerce_get_cart_url' ) ) {
/**
* Filters and returns the WooCommerce cart URL for compatibility with WooCommerce 9.3.0.
*
* @param string $cart_url WooCommerce cart page URL.
*
* @return string Returns the filtered WooCommerce cart page URL.
*
* @since 4.8.3
*/
function astra_woocommerce_get_cart_url( $cart_url ) {
// Check if WooCommerce function exists.
if ( function_exists( 'wc_get_page_permalink' ) ) {
$cart_url = wc_get_page_permalink( 'cart' );
}
return $cart_url;
}
}