This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$packages = WC()->shipping->get_packages(); | |
foreach ( $packages[0]['rates'] as $key => $shipping_rate ) { | |
dump( [ $shipping_rate->get_id(), $shipping_rate->get_label() ] ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function registration_form_add_country_field() { | |
// Only show if secret arg is in URL. | |
if ( empty( $_GET['add_field'] ) || $_GET['add_field'] != 1 ) { | |
return; | |
} | |
$form = GFAPI::get_form( TEST_FORM_ID ); | |
$new_field_id = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Given a timestamp, return true if it is a leap year. | |
* | |
* @param int $timestamp A unix timestamp. | |
* | |
* @return bool | |
*/ | |
function is_leap_year( int $timestamp ): bool { |