Click Count on Download a File

Use this code.. $downloads = $product->get_files(); $product_id = $product->id; foreach( $downloads as $key => $each_download ) { $query = “SELECT SUM( download_count ) AS count FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE product_id = $product->id”; $count = $wpdb->get_var( $query ); if ( ! empty( $count ) ) { echo ‘<a href=”‘.$each_download[“file”].'”>Download (‘.$count.’)</a>’; } else { echo ‘<a href=”‘.$each_download[“file”].'”>Download</a>’; } … Read more

how to add custom reviews button in woocommerce order complete generated mail

You can overwrite woocommerce templates placing them in your theme. To overwrite e.g. email-order-details.php template, place it in yourtheme/woocommerce/email/email-order-details.php path. You can also add action to add your custom review button. function wpse_287685_woocommerce_email_after_order_table($order, $sent_to_admin, $plain_text, $email) { ?> <a href=”#”>Add review</a> <?php } add_action( ‘woocommerce_email_after_order_table’, ‘wpse_287685_woocommerce_email_after_order_table’, 10, 4 );

WooCommerce order created via REST – sending the date_created along

date_created is read-only value meaning that you cannot set it over the REST API. What you can do is: Send creation time from your “external system” as order meta data (sample PHP code below) and then in WooCommerce trigger the action using custom plug-in which updates order date_created according to a meta value. $json_encode[‘meta_data’][0][‘key’] = … Read more

How to change the link of product menu from wordpress admin panel

You can modify the admin navigation using the $menu global var. The following will accomplish what you’re after add_action( ‘admin_menu’, ‘my_plugin_edit_admin_menu’); function my_plugin_edit_admin_menu() { global $menu, $submenu; foreach ($menu as $menuKey => $menuItem) if ($menuItem[0] == ‘Products’) $menu[$menuKey][2] = ‘https://google.com/’; // wtv link you want // UPDATE: // remove the sub menu as well (note … Read more

(WooCommerce) Conflict with template – Can’t load payment methods

Issues like this may be caused by either a conflict with your theme or with another plugin. You can read more about plugin and theme conflicts in the documentation here: https://docs.woocommerce.com/document/woocommerce-self-service-guide/ The best way to determine if the issue is being caused by a theme and/or plugin is to do the following: Temporarily switch your … Read more