Cart Total / Details don’t update when user switches between 1x purchase and Subscription purchase

This topic has 16 replies, 5 voices, and was last updated 2 weeks, 6 days ago ago by Andrew Mitchell

  • Avatar: sethr
    sethr
    Participant
    March 28, 2024 at 21:56

    OK, I submitted a ticket about this issue to WooCommerce—but they are hinting that It’s a theme issue.

    I have WooCommerce Subscriptions plugin running. Which generally speaking is OK, but here is the specific use case that I’m finding a major issue with:

    If you go and select a product to purchase one time, then go down the cart path, in the cart path you can change your selection to a subscription (or visaversa). But when you do that in the cart page, using the radio buttons, it doesn’t fire the update to the CART TOTAL. So the big problem is that in essence the user can change their purchase to one or the other, but the cart total doesn’t update, they complete the order, and now we have a purchase cost that doesn’t align with the option selected. Customer service will hate me 🙂

    Thank you in advance for any direction on how to resolve this issue.

    Please, contact administrator
    for this information.
    15 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 29, 2024 at 08:07

    Hello,

    Thank you for reaching out to us with your concern.

    Kindly record a video illustrating the problem and the actions you have mentioned, and also provide temporary FTP access.

    For FTP access, we require the following details: FTP host, FTP username, FTP password, FTP port, and FTP encryption type. If you need assistance in creating these credentials, please reach out to your hosting provider who will guide you through the process.

    Best Regards,
    The 8Theme Team

    Avatar: sethr
    sethr
    Participant
    March 29, 2024 at 16:01

    Hello, please find details in private content area.

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    March 30, 2024 at 10:04

    Dear Sethr,

    We hope this message finds you well.

    We would like to provide you with a solution to the issue you are experiencing. Kindly insert the following snippet of code into the functions.php file located within your child theme directory:

    
    add_action('wp_footer', '__wp_footer');
    function __wp_footer(){
        if(is_cart()){
        ?>
        <script>
            (function ( $ ) {
                'use strict';
                $(document).on('change', '.subscription-option input[type=radio], .one-time-option input[type=radio]', function (){
                    $('.quantity .quantity-wrapper input').trigger('change');
                });
            })( window.jQuery );
        </script>
        <?php
        }
    }
    

    We trust that this will effectively address the problem at hand. Should you require any further assistance, please do not hesitate to reach out.

    Warm regards,
    The 8Theme Team

    Avatar: sethr
    sethr
    Participant
    March 30, 2024 at 15:21

    THANK YOU SO MUCH. This appears to solve it on my testing!

    Avatar: Justin
    Luca Rossi
    Support staff
    April 3, 2024 at 09:29

    Hi @sethr,

    In the spirit of gratitude, we want to express our appreciation for your trust in our products. As a valued customer, your experience matters greatly. Would you consider sharing it by giving our theme a deserving 5-star rating on ThemeForest?

    Click here to share your thoughts: https://themeforest.net/downloads
    Being part of our community means a lot, and your feedback contributes immensely.

    Best Regards,
    The 8Theme Team

    Avatar: sethr
    sethr
    Participant
    April 3, 2024 at 15:13

    Thanks for re-opening this ticket.

    Since the provided solution, which is working perfectly on desktop, users have noticed that on MOBILE, the radio button selection dissapears after changing selection IN THE CART VIEW.

    In the video i’m supplying in private area, you can see where i’m adding a single purchase to cart, going to cart, then changing form single, to subscription, back again, etc. The radio button highlights, until the AJAX update to cart total is finished, then it disappears.

    Thank you in advance for any help.

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    April 4, 2024 at 07:05

    Dear Sethr,

    We hope this message finds you well.

    We’re pleased to inform you that we have implemented an update to the custom codes as detailed below:

    
    add_action('wp_footer', '__wp_footer');
    function __wp_footer(){
        if(is_cart()){
        ?>
        <script>
            (function ( $ ) {
                'use strict';
    			$(document).ready(function(){
    				if( $(window).width() < 768 ){
    					$('.one-time-option input[type="radio"]').first().prop('checked', true);
    				}
    			});
                $(document).on('change', '.subscription-option input[type=radio], .one-time-option input[type=radio]', function (){
                    $('.quantity .quantity-wrapper input').trigger('change');
                });
            })( window.jQuery );
        </script>
        <?php
        }
    }
    

    This update has been tested and is now functioning correctly on mobile devices as well. We kindly request that you review the changes at your earliest convenience to ensure everything is to your satisfaction.

    Please be advised that any further customizations may require the attention of the plugin’s author, as the issue addressed was not related to our XStore theme. We appreciate your understanding in this matter.

    Thank you for your continued collaboration.

    Best regards,
    The 8Theme Team

    Avatar: sethr
    sethr
    Participant
    April 4, 2024 at 15:30

    Hello, thank you, and thank you for alerting me this is really a plugin issue not a theme issue. It’s challenging as WooCommerce is saying it’s not their problem? Again, appreciate the support!!

    I just made sure this new block of code is in my child functions.php—but I do not see it working while testing.

    I can make the width of my desktop browser very narrow, and the check box highlights still go away if user changes, as well as on actual mobile device—the issue seems to still be there for me.

    Avatar: Brooke
    Brooke
    Participant
    April 4, 2024 at 18:02

    The updated code snippet solved the problems on my site. Thanks so much!

    Avatar: sethr
    sethr
    Participant
    April 4, 2024 at 19:10

    Hey Brooke! When you say solved, do you mean the last code block provided, solving the specific MOBILE radio button issue? or do you mean the first code block, solving the UPDATE CART TOTAL issue? LMK, thanks~!

    Avatar: Justin
    Luca Rossi
    Support staff
    April 5, 2024 at 07:04

    Hi @sethr,

    We’re unable to login via this login URL anymore.

    Can you please check?

    Thank you!

    Please contact administrator
    for this information.
    Avatar: sethr
    sethr
    Participant
    April 6, 2024 at 17:48

    Oh it expired, try again. See URL in private.

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    April 7, 2024 at 16:05

    Hi @sethr,

    We’ve updated the custom code to this:

    
    add_action('wp_footer', '__wp_footer');
    function __wp_footer(){
        if(is_cart()){
        ?>
        <script>
            (function ( $ ) {
                'use strict';
    			$(document).ready(function(){
    				if( $(window).width() < 768 ){
    					var current = $('input[type=radio]:checked', '.woocommerce-cart-form').val();
    					$('td.product-price.mob-hide ul').remove();
    					$(":radio[value=" + current + "]").prop("checked", true);
    				}
    			});
    			$( document.body ).on( 'updated_cart_totals', function(){
    				if( $(window).width() < 768 ){
    					var current = $('input[type=radio]:checked', '.woocommerce-cart-form').val();
    					$('td.product-price.mob-hide ul').remove();
    					$(":radio[value=" + current + "]").prop("checked", true);
    				}
    			});
                $(document).on('change', '.subscription-option input[type=radio], .one-time-option input[type=radio]', function (){
                    $('.quantity .quantity-wrapper input').trigger('change');
                });
            })( window.jQuery );
            
        </script>
        <?php
        }
    }
    

    Now it’s working on mobile also.


    From now please be advised that any further customizations may require the attention of the plugin’s author, as the issue addressed was not related to our XStore theme. We appreciate your understanding in this matter.

    Thank you for your continued collaboration.

    Best regards,
    The 8Theme Team

    Avatar: sethr
    sethr
    Participant
    April 7, 2024 at 17:09

    Tested, on mobile, absolutely stellar. Working perfectly. THANK YOU SO MUCH for following through on this solution for me, even though it was out of scope of the theme support. I am grateful and will be recommending 8theme to others!!

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    April 7, 2024 at 17:09

    Dear sethr,

    Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?

    Click here to share your insights: https://themeforest.net/downloads

    Your support fuels our journey, and we appreciate it more than words can express.

    Best Regards,
    The 8Theme Team

  • Viewing 16 results - 1 through 16 (of 16 total)

The issue related to '‘Cart Total / Details don’t update when user switches between 1x purchase and Subscription purchase’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.