Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. add_action( 'woocommerce_after_shipping_rate', 'blm_action_after_shipping_rate', 20, 2 );
  2.  
  3. function blm_action_after_shipping_rate ( $method, $index ) {
  4. if( is_cart() ) {
  5. return; // Exit on cart page
  6. }
  7.  
  8. // Use $method->method_id in here to check delivery option
  9.  
  10. }
  11.  
  12. add_action( 'woocommerce_after_shipping_rate', 'blm_action_after_shipping_rate', 20, 2 );
  13. function blm_action_after_shipping_rate ( $method, $index ) {
  14. if( is_cart() ) {
  15. return; // Exit on cart page
  16. }
  17.  
  18. $shipping_country = WC()->customer->get_shipping_country();
  19. $shipping_state = WC()->customer->get_shipping_state();
  20.  
  21. // Testing output
  22. echo '<br><small>Country code:' . $shipping_country . ' | State code: ' . $shipping_state . '</small>';
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement