Skip to content

Instantly share code, notes, and snippets.

View GhostPengy's full-sized avatar
🎧
Enjoying good music

GhostPengy

🎧
Enjoying good music
View GitHub Profile
@GhostPengy
GhostPengy / woocommerce_update_shipping_costs.php
Created July 6, 2018 15:40 — forked from neamtua/woocommerce_update_shipping_costs.php
WooCommerce: Update shipping costs on checkout using ajax
<script type="text/javascript">
/* in order to update info on your checkout page you need to trigger update_checkout function
so add this in your javascript file for your theme or plugin
*/
jQuery('body').trigger('update_checkout');
/* what this does is update the order review table but what it doesn't do is update shipping costs;
the calculate_shipping function of your shipping class will not be called again;
so if you were like me and you made a shipping method plugin and you had to change costs based on payment method then