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
// add the action | |
add_action( 'woocommerce_product_meta_end', 'action_woocommerce_after_add_to_cart_form'); | |
// define the woocommerce_after_add_to_cart_form callback | |
function action_woocommerce_after_add_to_cart_form( ) { | |
global $product; | |
$productId = $product->get_id(); | |
$productName = $product->get_name(); | |
// make action magic happen here... | |
echo '</div></div><div id="beforeContact" class="container w-100 p-2" style="clear: both;"></div>'; |
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
const getTimezone = async () => { | |
let get_url = "https://your-domain/wp-json/wp/v2/users/" + userId; | |
axios.get(get_url, { | |
headers: { | |
'X-WP-Nonce': nonce, | |
} | |
}).then((response) => { | |
console.log(response.data.timezone); | |
}) | |
} |
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
//Add a timezone field to user profile - Wes Huber 10/2022 | |
add_action( 'rest_api_init', 'adding_user_meta_rest' ); | |
function adding_user_meta_rest() { | |
register_rest_field( 'user', | |
'timezone', | |
array( | |
'get_callback' => 'user_meta_callback', | |
'update_callback' => 'timezone_update', | |
'schema' => null, |