Guest User

Untitled

a guest
Apr 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. $('.wcd-cart-wrapper input[name="wcd_option"]').on('change', function() {
  2. var data = {
  3. 'enabled': $(this).val(),
  4. 'action': 'update_cart_subtotal'
  5. };
  6.  
  7. $.post( ajaxurl, data, function( response ) {
  8. console.log( response );
  9. });
  10. });
  11.  
  12. public static function update_cart_subtotal() {
  13. $enabled = $_POST['enabled'];
  14. $value = 20;
  15. $cart = WC()->cart;
  16. if( 'enabled' == $enabled ) {
  17. $cart->set_subtotal($value);
  18. }
  19.  
  20. wp_send_json( $cart->get_subtotal() );
  21. }
Add Comment
Please, Sign In to add comment