相关疑难解决方法(0)

WooCommerce 在结帐页面上使用 ajax 向购物车总数添加自定义费用

I am trying make it when user changes the Shipping address select dropdown it dynamically add a fee to cart totals using ajax.I could able to to get the value but when select a another state it wont update the totals.

我的ajax请求:

jQuery(document).ready(function () {
    jQuery('#shipping_state').change(function () {
        var data = {
            action: 'woocommerce_custom_fee',
            security: wc_checkout_params.update_order_review_nonce,
            add_order_fee: 'state',
            post_data: jQuery('form.checkout').serialize()
        };
        jQuery.ajax({
            type: 'POST',
            url: wc_checkout_params.ajax_url,
            data: data,
            success: function (code) {
                var result = '';
                result = jQuery.parseJSON(code);
                if …
Run Code Online (Sandbox Code Playgroud)

php ajax wordpress woocommerce woothemes

6
推荐指数
1
解决办法
5935
查看次数

如何使用Woocommerce WC_AJAX类

我正在开发一个基于Wordpress WooCommerce的商店。我使用ajax进行数据调用。但是我正在通过wp-admin / admin-ajax.php在function.php文件中使用自己的函数进行操作。

昨天我在woocommerce类WC_AJAX中找到了。我的问题是如何启用该类中的事件,以及如何从js中调用它们。

php ajax jquery woocommerce

5
推荐指数
1
解决办法
618
查看次数

标签 统计

ajax ×2

php ×2

woocommerce ×2

jquery ×1

woothemes ×1

wordpress ×1