Woocommerce – Dynamic Link to The Most Recently Added Product

This code will do what you want. It will redirect to the latest product added if you add ?latest_product to your site’s URL. So the dynamic link would be http://example.com/?latest_product function wpse_274155_redirect_latest_product() { // If URL has ?latest_product query string. if ( isset( $_GET[‘latest_product’] ) ) { // Get latest product. $latest_products = get_posts( array( … Read more

WooCommerce Admin Only Email Hook

The hook woocommerce_email_order_details has 4 parameters which can help you to identify the correct message. add_action( ‘woocommerce_email_order_details’, ‘so274215_add_transaction_id’, 10, 4); function so274215_add_transaction_id( $order, $sent_to_admin, $plain_text, $email ){ // decide here wether to show your transaction id if ( ! $sent_to_admin ) echo ‘<span style=”color:#555;font-size:1.5em;”>Transaction ID: ‘.get_post_meta( $order->id, “_transaction_id”, true ).'</span>’; } As far as I … Read more

WooCommerce Variation Swatches and Photos – get attribute thumbnail

I resolved it by using get_woocommerce_term_meta $terms = get_terms( array( ‘taxonomy’ => ‘pa_texture’, ‘hide_empty’ => false, )); foreach ( $terms as $term ) : $thumbnail_id = get_woocommerce_term_meta( $term->term_id, ‘pa_texture_swatches_id_photo’, true ); $textureImg = wp_get_attachment_image_src( $thumbnail_id, ‘full’ ); ?> <img src=”https://wordpress.stackexchange.com/questions/274247/<?php echo $textureImg[0]; ?>”> endforeach;

Understanding WooCommerce Build-In Geolocation/ Geo_IP classes

This is how I used WooCommerce to get the country code on a recent project, using the geolocate_ip method of the WC_Geolocation class. $country = ‘US’; if (class_exists(‘WC_Geolocation’)) { $location = WC_Geolocation::geolocate_ip(”, true, false); if (isset($location[‘country’])) { $country = $location[‘country’]; } } switch ($country) { case ‘AU’: break; case ‘US’: break: }

WP_Query to Retrieve Posts from WooCommerce Products that are Only in Catalog

Posted too quick. Found a solution shortly after This works: $params = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’, ‘orderby’ => ‘menu-order’, ‘order’ => ‘asc’, ‘fields’ => ‘ids’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_visibility’, ‘field’ => ‘term_id’, ‘terms’ => 7, ‘operator’ => ‘NOT IN’) )); $wc_query = new WP_Query($params); $ids = $wc_query->posts; echo ‘<pre>’; … Read more

Woocommerce Languages Files

i run today into the same problem. When your main WordPress language is German than WooCommerce installs automatically the German language files. Otherwise you have to include the translation files into “wp-content/languages/plugins”. You can download them here: (Du-Form) https://github.com/Tech-Nomad/woocommerce-de_DE (Sie-Form) https://github.com/Tech-Nomad/woocommerce-de_DE_formal Try also to un- and reinstall the WooCommerce Plugin if you didn’t make a … Read more

mydomain.com/wp-login redirects to wordpress.com/wp-login

You trying to change you .htaccess file probably look like this: Note: Don’t forgot to clean your browser cache. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule /wp-admin/ /wp-admin/index\.php [L,P] RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress