Filter WooCommerce archive pages by an additional category

you need to add your topic to query_vars. function so306156_add_query_vars_filter($vars) { $vars[] = “topic”; return $vars; } add_filter(‘query_vars’, ‘so306156_add_query_vars_filter’); and then, in pre_get_posts, you check for that var and act accordingly: function so306156_manipulate_main_query($wp_query) { if (function_exists(‘is_woocommerce’) && !is_admin()) : if ($wp_query->is_main_query() && is_woocommerce()) { if (isset($wp_query->query_vars[‘topic’])) { $tax_query = $query->get(‘tax_query’); $tax_query[] = [ ‘taxonomy’ => … Read more

How can I remove a WooCommerce Product Tab’s sub section in wp-admin?

To change this “sub navigation” you could use the WooCommerce filter “woocommerce_get_sections_products“. The following example code will remove the sub navigation point “inventory”: function change_navi_function($sections) { // remove sub navigation point “inventory” unset($sections[‘inventory’]); return $sections; } add_filter(‘woocommerce_get_sections_products’, ‘change_navi_function’); What you have to do now is either to hook your “change_navi_function” function after the function from … Read more

Way to redirect all Product Sub Category to its Main category Page?

You will have to use JS for the redirection since header is already sent before we can check the category, following snippet would do the work: add_action(‘woocommerce_before_main_content’,’redirect_to_top_level_parent’,1); function redirect_to_top_level_parent(){ if (is_product_category()){ $cate = get_queried_object(); $cateID = $cate->term_id; $parentcats = get_ancestors($cateID, ‘product_cat’); $count = count($parentcats); if ($count > 0){ $count = $count-1; $link = get_term_link( $parentcats[$count], … Read more

Woocommerce – Display stock quantity per variation

Displaying stock quantity per product variant is default WooCommerce behavior. For best results, when you develop own theme, use default storefront/woocommerce HTML structure and JS files then style it using CSS styles. To test stock quantity per product variant is displaying correctly I installed clean WordPress 4.9.6 and WooCommerce 3.4.3 and followed Variable product page … Read more

How do I get the Payzone WooCommerce payment gateway plugin to show up in the settings? [closed]

As Rustom mentioned, the plugin isn’t checking if this Multisite is activated – you can add a check in for multisite, add the below in the plugin registration file, just below the existing active check functions. if(!function_exists(‘is_plugin_active_for_network’)){ require_once(ABSPATH .’/wp-admin/includes/plugin.php’); if(is_multisite() && is_plugin_active_for_network(‘woocommerce/woocommerce.php’)){//check if multisite and check /** add in the functions from inside the current … Read more

Get woocommerce coupon code

You could use the woocommerce_applied_coupon hook. You find the “implementation” in the class WC_Cart ( method apply_coupon) Usage example: function my_little_coupon_func($coupon_code) { echo “coupon is correct: “. $coupon_code; // now send your email } add_action(‘woocommerce_applied_coupon’, ‘my_little_coupon_func’);

Adding an external link to product grid list pages for woocommerce

A possible hook to position a button in that point is woocommerce_after_shop_loop_item: add_action(“woocommerce_after_shop_loop_item”,”Stack_308575_add_button”,99); function Stack_308575_add_button(){ global $product; echo “<button onclick=\”alert(“.wc_get_product($product)->id.”)\”>Click</button>”; } If you need dynamic links you can get the global $product object and retrieve data from there