Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('.wcd-cart-wrapper input[name="wcd_option"]').on('change', function() {
- var data = {
- 'enabled': $(this).val(),
- 'action': 'update_cart_subtotal'
- };
- $.post( ajaxurl, data, function( response ) {
- console.log( response );
- });
- });
- public static function update_cart_subtotal() {
- $enabled = $_POST['enabled'];
- $value = 20;
- $cart = WC()->cart;
- if( 'enabled' == $enabled ) {
- $cart->set_subtotal($value);
- }
- wp_send_json( $cart->get_subtotal() );
- }
Add Comment
Please, Sign In to add comment