From: soufiane Date: Tue, 11 Feb 2025 16:30:18 +0000 (+0100) Subject: wait #7310 @9:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=641926eb5cc3320dfd85c15e7d11e8c8ccebf66a;p=physioassist-wordpress.git wait #7310 @9:00 --- diff --git a/wp-content/themes/physioassist/resources/functions.php b/wp-content/themes/physioassist/resources/functions.php index b2881a39..68d0d4e4 100644 --- a/wp-content/themes/physioassist/resources/functions.php +++ b/wp-content/themes/physioassist/resources/functions.php @@ -153,38 +153,37 @@ add_filter('wps_sfw_show_one_time_subscription_price', function($price) { return $price; }); -add_action('woocommerce_after_add_to_cart_quantity', function($product_id = false) { +add_action('woocommerce_after_add_to_cart_quantity', function($wps_skip_creating_subscription, $product_id = false) { if(!$product_id) { global $product; } $product_id = $product_id ?? $product->get_id(); $wps_price_html = "
"; - $wps_price_html .= "

Frequency

"; + $wps_price_html .= "

Fréquence

"; $wps_price_html .= '
'; $wps_price_html .= '
'; - $wps_price_html .= '
'; $wps_price_html .= '
'; // translators: placeholder is price_discount_percentage. - $wps_price_html .= '
'; + $wps_price_html .= '
'; $wps_price_html .= '
'; $wps_price_html .= ""; echo $wps_price_html; }); -/*add_action('wp_enqueue_scripts', function() { - if (is_page(9803)) { - // Forcer l'inclusion des CSS WooCommerce - wp_enqueue_style('woocommerce-general', WC()->plugin_url() . '/assets/css/woocommerce.css', array(), null); - wp_enqueue_style('woocommerce-layout', WC()->plugin_url() . '/assets/css/woocommerce-layout.css', array(), null); - wp_enqueue_style('woocommerce-smallscreen', WC()->plugin_url() . '/assets/css/woocommerce-smallscreen.css', array(), null, 'only screen and (max-width: 768px)'); - - // Forcer les scripts JS nécessaires - wp_enqueue_script('wc-cart', WC()->plugin_url() . '/assets/js/frontend/cart.min.js', array('jquery'), null, null); - wp_enqueue_script('wc-cart', WC()->plugin_url() . '/assets/js/frontend/add-to-cart.min.js', array('jquery'), null, null); - wp_enqueue_script('wc-checkout', WC()->plugin_url() . '/assets/js/frontend/checkout.min.js', array('jquery'), null, null); +add_action( 'woocommerce_update_cart_action_cart_updated', function($cart_updated){ + foreach ( WC()->cart->cart_contents as &$cart_item ) { + if($_POST['wps_type_selection'] === "one_time") { + apply_filters('wps_skip_creating_subscription', true, $cart_item); + $cart_item["wps_type_selection"] = "one_time"; + }else{ + apply_filters('wps_skip_creating_subscription', false, $cart_item); + $cart_item["wps_type_selection"] = "subscribe"; + } } -}, 999);*/ + return true; +});