diff --git a/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css b/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css index b4b3192..4e8d326 100644 --- a/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css +++ b/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css @@ -65,4 +65,26 @@ main{ background-color: #fff !important; margin-top: 2rem; width: 100%; +} + + +.anons-article__more-link { + display: flex; + align-items: center; + justify-content: center; +} + +.anons-article__more-link{ + background: var(--accent-3); + color: var(--main_white); + border-radius: 20px; + border: 1px solid var(--main_white); + padding: 16px 24px; + font-size: 20px; + font-weight: 600; + line-height: 24px; + text-transform: uppercase; + margin-right: auto; + margin-left: auto; + width: max-content; } \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php b/wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php index 4e9f8ad..c5354f9 100644 --- a/wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php +++ b/wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php @@ -1,22 +1,46 @@ -cart->get_cart_contents_count(); - return $context; -}); - - -add_action('wp_enqueue_scripts', 'enable_ajax_add_to_cart_single'); -function enable_ajax_add_to_cart_single() { - if (is_product()) { - wp_enqueue_script('wc-add-to-cart-variation'); // для вариативных товаров - wp_enqueue_script('wc-add-to-cart'); // основной скрипт для добавления в корзину - } +cart)) { + $context['cart_count'] = WC()->cart->get_cart_contents_count(); + } + if (defined('WP_IMPORTING') && WP_IMPORTING) { + $context['cart_count'] = 0; + } + return $context; + }); +}, 20); + +// Подключение скриптов для AJAX-добавления в корзину +add_action('wp_enqueue_scripts', 'enable_ajax_add_to_cart_single'); +function enable_ajax_add_to_cart_single() { + if (is_product()) { + wp_enqueue_script('wc-add-to-cart-variation'); + wp_enqueue_script('wc-add-to-cart'); + error_log('WooCommerce scripts enqueued on product page'); + } +} + +// Добавление перевода для WooCommerce скриптов +add_filter('woocommerce_get_script_data', 'add_custom_woocommerce_params', 10, 2); +function add_custom_woocommerce_params($params, $handle) { + if (in_array($handle, ['wc-cart', 'wc-add-to-cart'])) { + $params['i18n_restore_item'] = function_exists('pll__') ? pll__('Восстановить') : __('Восстановить', 'cosmopet'); + } + return $params; } \ No newline at end of file