let date = Date()
let msg = "Hi my dear friends\(date)"
let urlWhats = "whatsapp://send?phone=phoneNumber&abid=phoneNumber&text=hi"
if let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed) {
if let whatsappURL = NSURL(string: urlString) {
if UIApplication.shared.canOpenURL(whatsappURL as URL) {
UIApplication.shared.openURL(whatsappURL as URL)
} else {
print("please install watsapp")
}
}
}
在刷新页面上显示我想要的但是当页面满载字段顺序变得像以前一样。请建议我。
提前致谢
答案 0 :(得分:0)
您需要设置优先级以及重新排序。试试这个。
add_filter("woocommerce_checkout_fields", "order_fields",99);
function order_fields($fields) {
$order = array(
"billing_first_name"=>10,
"billing_last_name"=>20,
"billing_company"=>30,
"billing_email"=>40,
"billing_country"=>50,
"billing_address_1"=>60,
"billing_state"=>70,
"billing_postcode"=>80,
"billing_city=>90"
);
foreach($order as $field=>$priority)
{
$ordered_fields[$field] = $fields["billing"][$field];
$ordered_fields[$field]['priority']=$priority;
}
$fields["billing"] = $ordered_fields;
return $fields;
}
答案 1 :(得分:0)
add_filter( 'woocommerce_default_address_fields', 'bbloomer_move_checkout_fields_woo_3' );
function bbloomer_move_checkout_fields_woo_3( $fields ) {
$fields['first_name']['priority'] = 10;
$fields['last_name']['priority'] = 20;
$fields['company']['priority'] = 30;
$fields['email']['priority'] = 35;
$fields['country']['priority'] = 40;
$fields['address_1']['priority'] = 50;
$fields['state']['priority'] = 60;
$fields['postcode']['priority'] = 70;
$fields['city']['priority'] = 80;
return $fields;
}
function ld_wc_filter_billing_fields( $address_fields ) {
$address_fields['billing_email']['priority'] = 35;
return $address_fields;
}
add_filter( 'woocommerce_billing_fields', 'ld_wc_filter_billing_fields', 10, 1 );
我有很多搜索并获得此代码。这段代码对我来说很合适。