change state value in woocommerce

//hide default state drop down for billing field jQuery(“#billing_state_field”).find(“span.select2-container”).hide(); //if billing state id found then replace a custom field if (jQuery(‘#billing_state’).length) { jQuery(“#billing_state”).replaceWith(`<input type=”text” class=”input-text ” name=”billing_state” id=”billing_state” placeholder=”” value=”${addressComponent.state_long}” autocomplete=”address-level2″ style=”border: none;”></input>`); }

Remove field from checkout page in woocommerce wordpress

/** Remove all possible fields **/ function wc_remove_checkout_fields( $fields ) { // Billing fields unset( $fields[‘billing’][‘billing_company’] ); unset( $fields[‘billing’][‘billing_email’] ); unset( $fields[‘billing’][‘billing_phone’] ); unset( $fields[‘billing’][‘billing_state’] ); unset( $fields[‘billing’][‘billing_first_name’] ); unset( $fields[‘billing’][‘billing_last_name’] ); unset( $fields[‘billing’][‘billing_address_1’] ); unset( $fields[‘billing’][‘billing_address_2’] ); unset( $fields[‘billing’][‘billing_city’] ); unset( $fields[‘billing’][‘billing_postcode’] ); // Shipping fields unset( $fields[‘shipping’][‘shipping_company’] ); unset( $fields[‘shipping’][‘shipping_phone’] ); unset( $fields[‘shipping’][‘shipping_state’] …

Remove field from checkout page in woocommerce wordpress Read More »

Copy to clipboard in jquery

 function copyToClipboard(elementId) { var copyTextarea = document.getElementById(elementId); console.log(copyTextarea); copyTextarea.select(); document.execCommand(“copy”); jQuery(“.copy”).html(“Copied”); if (jQuery(‘.tcopy’).length) { jQuery(‘#’ + elementId.slice(1)).html(“Copied”); } jQuery(“#liveToast”).toast(“show”); }

get date and time from timestamp in js

  function getDateTime(MatchTimeStamp){     var date = new Date(MatchTimeStamp); var Hours = date.getHours() >12 ? date.getHours()-12 : date.getHours(); var ampm = date.getHours() >= 12 ? ‘pm’ : ‘am’; var fullDate = `${date.getDate()}–${date.getMonth()+1}–${ date.getFullYear()}`; var fullTime = `${Hours}:${date.getMinutes()} ${ampm}`; return {‘date’: fullDate , ‘time’ : fullTime} }

Update particular key and its value in wp_option table in wordpress

//first get all the value by get option   $saved_lisc_data = get_option( ‘lisc_settings’); //then put the update the key and its value $saved_lisc_data[‘lisc_match_status’] = ‘complete’; //then update the option update_option( ‘lisc_settings’ , $saved_lisc_data); //for multiple value update $lisc_updated_data = get_option( ‘lisc_settings’); $lisc_updated_data[‘lisc_enable_status’] = $lisc_enable_status; $lisc_updated_data[‘lisc_api_url’] = $_POST[‘lisc_api_url’]; $lisc_updated_data[‘lisc_interval’] = $_POST[‘lisc_interval’]; $lisc_updated_data[‘lisc_total_timing’] = $_POST[‘lisc_total_timing’]; update_option( ‘lisc_settings’ , …

Update particular key and its value in wp_option table in wordpress Read More »