WooCommerce: Add New Report Tab

add_filter(‘woocommerce_admin_reports’,’custom_tab’); function custom_tab($reports) { $reports[‘custom_tab’]= array( ‘title’=>__(‘Custom Reports’,’woocommerce’), ‘description’=> ‘WooCommerce Orders Listing Here…’, ‘hide_title’=> true, ‘callback’=>array(‘wc_admin_orders_customers’, ‘display_orders_list_cusotomers’) ); return $reports; }

Hide certain tags on Product Edit tag cloud

You can add a filter via the theme’s functions.php file (I’d recommend you use a child-theme for customizations, but that’s outside the scope of this question) The following will limit the tag-cloud in the wp-admin backend to the first 5. function tryme($tag_data){ $short_tag_data = array_slice($tag_data, 0, 5, true); return $short_tag_data; } add_filter( ‘wp_generate_tag_cloud_data’, ‘tryme’ ); … Read more

How to build a plugin that supports authenticated POST requests to the REST API from external servers?

Answering my own question. For plugin developers, the directive is to use current_user_can() in your code as usual in the REST endpoints, as Core does. WordPress 5.4 does not support authenticated requests originated from outside WordPress to the REST API yet. But your clients can use plugins such as Basic Auth, OAuth2 or JWT to … Read more

Default woocommerce placeholder image

The code for changing the default image is provided by WooCommerce in this link but for your requirement we have to customize the code as follows /* * goes in theme functions.php or a custom plugin. Replace the image filename/path with your own 🙂 * **/ add_action(‘init’, ‘custom_fix_thumbnail’); function custom_fix_thumbnail() { add_filter(‘woocommerce_placeholder_img_src’, ‘custom_woocommerce_placeholder_img_src’); function custom_woocommerce_placeholder_img_src($src) … Read more

Adding an action within a function that is being called by add_filter

The answer when the question is about hooks is always either: timing, priority, or both. Consider the following code: add_action( ‘shutdown’, ‘wpse_258451_shutdown’ ); function wpse_258451_shutdown() { add_action( ‘init’, ‘wpse_258451_init’ ); } function wpse_258451_init() { wp_die( ‘I will never be called.’ ); } It should be obvious that the function wpse_258451_init() will never be called. This … Read more

Woo-commerce | Disable proceed to checkout button in cart page if total in cart less than 15 [closed]

Try this: function disable_checkout_button_no_shipping() { $total = WC()->cart->get_cart_subtotal(); // Change made if( $total < 15 ){ remove_action( ‘woocommerce_proceed_to_checkout’, ‘woocommerce_button_proceed_to_checkout’, 20 ); echo ‘<a href=”#” class=”checkout-button button alt wc-forward”>Proceed to checkout</a>’; } } add_action( ‘woocommerce_proceed_to_checkout’, ‘disable_checkout_button_no_shipping’, 1 );

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