]> _ Git - physioassist-wordpress.git/commitdiff
wait #7310 @9:00
authorsoufiane <soufiane@cubedesigners.com>
Tue, 11 Feb 2025 16:30:03 +0000 (17:30 +0100)
committersoufiane <soufiane@cubedesigners.com>
Tue, 11 Feb 2025 16:30:03 +0000 (17:30 +0100)
wp-content/themes/physioassist/resources/assets/scripts/routes/common.js
wp-content/themes/physioassist/resources/views/woocommerce/cart/cart.php

index aef188631b289739f02dccc429df70f5782a192b..a2475c221f03e862625585d180145d5e09cce50f 100644 (file)
@@ -24,7 +24,6 @@ export default {
       menu.toggle();
     });
 
-
     // Disable clicks on top level menu links that have sub-menus
     $(document).on('click', '.navigation .menu-item-has-children > a', function(event) {
       event.stopPropagation();
@@ -59,6 +58,20 @@ export default {
 
     window.addEventListener('scroll', throttle(headerTransition, 100)); // Throttle 100ms for scroll event
 
+    //
+    if ( $('.wps_sfw_check_simple_cart_subscription_purchase').length > 0 ) {
+      $('.wps_sfw_check_simple_cart_subscription_purchase:not(:checked)').prop('checked', false);
+    } else {
+      setTimeout(() => {
+        $('.wps_sfw_check_simple_cart_subscription_purchase:not(:checked)').prop('checked', false);
+      }, 100);
+    }
+
+    //
+    $(document).on("change", ".woocommerce-cart-form", function(){
+      const isApp = window.location.search.substring(1).split("&").includes("app=true")
+      if(isApp) $("button[name=update_cart]").trigger("click")
+    })
   },
   finalize() {
     // JavaScript to be fired on all pages, after page specific JS is fired
index 43f93d2fdff3f9700e076981fe106d287ced3a90..1b9350d9585d2c625bfc9db3b35af40e301c74be 100644 (file)
@@ -30,7 +30,7 @@ do_action( 'woocommerce_before_cart' ); ?>
             <th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
             <th class="product-price"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
             <th class="product-quantity"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
-            <th class="product-frequency"></th>
+            <th class="product-frequency">Fréquence</th>
             <th class="product-subtotal"><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
         </tr>
         </thead>
@@ -145,11 +145,11 @@ do_action( 'woocommerce_before_cart' ); ?>
                     <?php
                     if ( wps_sfw_check_product_is_subscription( $cart_item['data'] )) {
                       $wps_skip_creating_subscription = apply_filters( 'wps_skip_creating_subscription', true, $cart_item );
-                      if ( $wps_skip_creating_subscription ) {?>
+                      ?>
                       <td class="product-frequency" data-title="<?php esc_attr_e( 'Frequency', 'woocommerce' ); ?>">
-                        <?php do_action('woocommerce_after_add_to_cart_quantity', $product_id); ?>
+                        <?php do_action('woocommerce_after_add_to_cart_quantity', $wps_skip_creating_subscription, $product_id); ?>
                       </td>
-                      <?php }
+                      <?php
                     }
                     ?>
                     <td class="product-subtotal" data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>">
@@ -164,8 +164,7 @@ do_action( 'woocommerce_before_cart' ); ?>
         ?>
 
         <?php do_action( 'woocommerce_cart_contents' ); ?>
-
-        <tr>
+        <tr <?php echo (filter_input(INPUT_GET, 'app', FILTER_SANITIZE_STRING) === "true" ? "style=display:none;" : "") ?>>
             <td colspan="7" class="actions">
 
                 <?php if ( wc_coupons_enabled() ) { ?>
@@ -182,7 +181,8 @@ do_action( 'woocommerce_before_cart' ); ?>
                 <?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
             </td>
         </tr>
-
+        <?php
+        ?>
         <?php do_action( 'woocommerce_after_cart_contents' ); ?>
         </tbody>
     </table>