Woocommerce checkout in popup

I am trying to implement checkout fuctionality (+ stripe with WooCommerce Stripe Payment Gateway plugin) in a modal and I am using ajax for that. Here is my internal code to get / update the skin:

add_action('wp_ajax_refresh_checkout', 'getCheckoutPageContentCallBack');
add_action('wp_ajax_nopriv_refresh_checkout', 'getCheckoutPageContentCallBack');

function getCheckoutPageContentCallBack() {
    define('WOOCOMMERCE_CHECKOUT', true);
    echo do_shortcode('[woocommerce_checkout]');
    if (class_exists('WooCommerce')) {
        $wcurl = WooCommerce::plugin_url();

        $credit_card_form_script = file_get_contents($wcurl . '/assets/js/frontend/credit-card-form.min.js');
        if ($credit_card_form_script) {
            echo "<script>";
            echo $credit_card_form_script;
            echo "</script>";
        }

        $checkout_script = file_get_contents($wcurl . '/assets/js/frontend/checkout.min.js');
        if ($checkout_script) {
            echo "<script>";
            echo $checkout_script;
            echo "</script>";
        }
    }
    wp_die();
}

      

I have included all scripts, on the checkout page, but I still get the error:

Please enter your card details to make a payment. Developers: Make sure you have jQuery enabled and there are no JavaScript errors on the page.

jQuery is included and there are no js errors on the page. The original checkout page works just fine. I thought the problem was that I removed the payment part from the original part with this code:

remove_action('woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20);
add_action('woocommerce_checkout_order_payment', 'woocommerce_checkout_payment', 20);

      

But commenting out these lines gave me nothing. I edited the page so that now it is not even a store page (just a page with a loop). I noticed that when making payments through the checkout page, the first request goes to https://api.stripe.com/v1/tokens with card credentials, the next one goes to / checkout /? wc-ajax = checkout with stripe_token and so on. When I try to check from my modal code, there is no sripe API request, just to check. Maybe there is a few script that needs to be included every time I update the checkout? Can't find information about this.

+3
checkout wordpress modal-dialog stripe-payments woocommerce


source to share


No one has answered this question yet

Check out similar questions:

4
Add user tip by customer to woocommerce checkout page
2
Getting 301 constantly translates with error when checking out woocommerce
1
Stripe Checkout doesn't work on mobiles, desktop browser works fine
1
Off-site demo of Drupal trading in modal
0
Error 404 Page not found. The requested URL could not be matched by routing. No exceptions
0
Simple jQuery script for woocommerce not working
0
How do I reload / update the Stripe Checkout button?
0
How to force code that is "outside of woocommerce / wordpress" to add a payment method with a form to update the list of payment methods after adding
0
getting "CRITICAL call to set_messages () member function at zero" when trying to check on Woocommerce
0
More specific / detailed WooCommerce validation errors?



All Articles
Loading...
X
Show
Funny
Dev
Pics