| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/soraavi/wp-content/plugins/variation-swatches-woo/compatibility/ |
Upload File : |
<?php
/**
* Astra Compatibility.
*
* @package variation-swatches-woo
* @since 1.0.0
*/
namespace CFVSW\Compatibility;
use CFVSW\Inc\Helper;
/**
* Astra Compatibility
*
* @since 1.0.0
*/
class Astra {
/**
* Adds filter to update shop positions as per astra theme
*
* @return void
* @since 1.0.0
*/
public function get_shop_positions() {
add_filter( 'cfvsw_swatches_shop_page_position', [ $this, 'positions_array' ] );
add_filter( 'astra_get_option_shop-hover-style', [ $this, 'override_hover_effect_change' ] );
add_filter( 'cfvsw_requires_global_settings', [ $this, 'is_required_astra_page' ] );
}
/**
* Returns astra theme positions
*
* @param array $default default position array.
* @return array
* @since 1.0.0
*/
public function positions_array( $default ) {
return wp_parse_args(
[
'before_title' => [
'action' => 'astra_woo_shop_before_summary_wrap',
'priority' => 10,
],
'after_title' => [
'action' => 'astra_woo_shop_title_after',
'priority' => 99,
],
'before_price' => [
'action' => 'astra_woo_shop_price_before',
'priority' => 9,
],
'after_price' => [
'action' => 'astra_woo_shop_price_after',
'priority' => 1,
],
],
$default
);
}
/**
* Overrides astra feature swap images on hover
*
* @param string $style current style selected for hover.
* @return string
* @since 1.0.0
*/
public function override_hover_effect_change( $style ) {
$helper = new Helper();
$get_shop_page_option = $helper->get_option( CFVSW_GLOBAL );
return ! empty( $get_shop_page_option['enable_swatches_shop'] ) && 'swap' === $style ? '' : $style;
}
/**
* Checks if current page is required astra page for variation swatches.
*
* @param bool $status current status.
* @return boolean
* @since 1.0.1
*/
public function is_required_astra_page( $status ) {
if ( ! function_exists( 'astra_get_option' ) ) {
return $status;
}
if ( ! astra_get_option( 'enable-cart-upsells' ) ) {
return $status;
}
return $status || is_cart();
}
}