How to put a date range in a virtual/downloadable product? [closed]

Hook into add_to_cart hook add_action(‘woocommerce_add_to_cart’, ‘create_files_for_cart’); function create_files_for_cart() { // Your code that created the file using the dated the user selected // More code to add the file created to cart } The code to create the downloadable file product is similar to the code in this answer Add the product to cart with … Read more

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

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: }

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)