• Resolved trentt22

    (@trentt22)


    On my WooCommerce checkout page, I am showing a notification before the order review section based on the cart total. I have included the following code in my functions.php file of my child theme:

    function action_woocommerce_checkout_before_order_review () {
        // Get cart total
        $cart_total = WC()->cart->get_cart_contents_total();
        
        // Compare
        if ( $cart_total == 0.01 ) {
            echo '<p>' . __( 'My message', 'woocommerce' ) . '</p>';
        }
    }
    add_action( 'woocommerce_checkout_before_order_review', 'action_woocommerce_checkout_before_order_review', 10, 0 );

    The problem with this code is that the notice does not appear if a coupon is applied to the order, such that the cart total equals 0.01 euro, but instead only appears after the page is refreshed.

    How can I alter this code such that the notice is added/removed through AJAX? Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers!

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘AJAX update order review table in checkout’ is closed to new replies.